mailing list of musl libc
 help / color / mirror / code / Atom feed
164302fd7eae43ba16bd5dbe3d576e8956a5d72a blob 1147 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
#include "pthread_impl.h"
#include <threads.h>

int cnd_signal(cnd_t * cond) {
	int ret = thrd_success;

	/* Avoid fight for critical section if there is nothing to
	   do. */
	if (!cond || !cond->_cx_cnd) return ret;

	/* Critical section protected by lock */
	__lock(&cond->_cx_lock);
	__cnd_t * c = cond->_cx_cnd;
	if (c) {
		if (c->wts) {
			++c->seq;
			/* Move one waiter to the ones to be woken up, later. */
			--c->wts;
			/* If this was the last waiter, unlink. */
			if (!c->wts) cond->_cx_cnd = 0;
			else __cnd_addref(c);
		} else {
			c = 0;
		}
	}
	__unlock(&cond->_cx_lock);

	/* If c is 0, there haven't been any waiters, yet, nothing to do. */
	if (c) {
		/* Do the delayed work. */
		a_inc(&c->tok);
		/* Move the threads of the previous sequence point to the token queue. */
		int ret0 = __syscall(SYS_futex, &c->seq, FUTEX_REQUEUE|THRD_PRIVATE,
		                     0,
		                     INT_MAX, &c->tok);
		int ret1 = __syscall(SYS_futex, &c->tok, FUTEX_WAKE|THRD_PRIVATE, 1);
		ret = ((ret0 < 0) || (ret1 < 0)) ? thrd_error : thrd_success;
		__cnd_unref(c);
	}
	return ret;
}
debug log:

solving a80e2e3 ...
found a80e2e3 in https://inbox.vuxu.org/musl/1408049748.4951.134.camel@eris.loria.fr/

applying [1/1] https://inbox.vuxu.org/musl/1408049748.4951.134.camel@eris.loria.fr/
diff --git a/src/thread/cnd_signal.c b/src/thread/cnd_signal.c\r
new file mode 100644\r
index 0000000..a80e2e3\r

1:7: trailing whitespace.
#include "pthread_impl.h"\r
1:8: trailing whitespace.
#include <threads.h>\r
1:9: trailing whitespace.
\r
1:10: trailing whitespace.
int cnd_signal(cnd_t * cond) {\r
1:11: trailing whitespace.
	int ret = thrd_success;\r
Checking patch src/thread/cnd_signal.c...
Applied patch src/thread/cnd_signal.c cleanly.
warning: squelched 36 whitespace errors
warning: 41 lines add whitespace errors.

index at:
100644 164302fd7eae43ba16bd5dbe3d576e8956a5d72a	src/thread/cnd_signal.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).