mailing list of musl libc
 help / color / mirror / code / Atom feed
3ab8a99448b53e7b93e0e99a888a6708914ca884 blob 838 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
 
#include "pthread_impl.h"
#include <threads.h>

int cnd_broadcast(cnd_t *c)
{
	mtx_t *m;

	if (!c->_c_waiters) return thrd_success;

	a_inc(&c->_c_seq);

	/* Block waiters from returning so we can use the mutex. */
	while (a_swap(&c->_c_lock, 1))
		__wait(&c->_c_lock, &c->_c_lockwait, 1, 1);
	if (!c->_c_waiters)
		goto out;
	m = c->_c_mutex;

	/* Move waiter count to the mutex */
	a_fetch_add(&m->_m_waiters, c->_c_waiters2);
	c->_c_waiters2 = 0;

	/* Perform the futex requeue, waking one waiter unless we know
	 * that the calling thread holds the mutex. */
	__syscall(SYS_futex, &c->_c_seq, FUTEX_REQUEUE,
		!m->_m_type || (m->_m_lock&INT_MAX)!=__pthread_self()->tid,
		INT_MAX, &m->_m_lock);

out:
	a_store(&c->_c_lock, 0);
	if (c->_c_lockwait) __wake(&c->_c_lock, 1, 0);

	return thrd_success;
}
debug log:

solving 70fb7a7 ...
found 70fb7a7 in https://inbox.vuxu.org/musl/1407144603.8274.248.camel@eris.loria.fr/

applying [1/1] https://inbox.vuxu.org/musl/1407144603.8274.248.camel@eris.loria.fr/
diff --git a/src/thread/cnd_broadcast.c b/src/thread/cnd_broadcast.c\r
new file mode 100644\r
index 0000000..70fb7a7\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_broadcast(cnd_t *c)\r
1:11: trailing whitespace.
{\r
Checking patch src/thread/cnd_broadcast.c...
Applied patch src/thread/cnd_broadcast.c cleanly.
warning: squelched 29 whitespace errors
warning: 34 lines add whitespace errors.

index at:
100644 3ab8a99448b53e7b93e0e99a888a6708914ca884	src/thread/cnd_broadcast.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).