mailing list of musl libc
 help / color / mirror / code / Atom feed
f16d617654e5a0f9f1eb5c66f5555cee09e876e5 blob 520 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
 
#include "pthread_impl.h"

static inline void __lock_fast(volatile int *l)
{
	extern void __lock_slow(volatile int*, int);
	if (!libc.threads_minus_1) return;
	/* fast path: INT_MIN for the lock, +1 for the congestion */
	int current = a_cas(l, 0, INT_MIN + 1);
	if (!current) return;
	__lock_slow(l, current);
}

static inline void __unlock_fast(volatile int *l)
{
	/* Check l[0] to see if we are multi-threaded. */
	if (l[0] < 0) {
		if (a_fetch_add(l, -(INT_MIN + 1)) != (INT_MIN + 1)) {
			__wake(l, 1, 1);
		}
	}
}
debug log:

solving f16d6176 ...
found f16d6176 in https://inbox.vuxu.org/musl/41048892c9aa47a6ebde97cd90f244981221a437.1514985618.git.Jens.Gustedt@inria.fr/

applying [1/1] https://inbox.vuxu.org/musl/41048892c9aa47a6ebde97cd90f244981221a437.1514985618.git.Jens.Gustedt@inria.fr/
diff --git a/src/internal/__lock.h b/src/internal/__lock.h
new file mode 100644
index 00000000..f16d6176

Checking patch src/internal/__lock.h...
Applied patch src/internal/__lock.h cleanly.

index at:
100644 f16d617654e5a0f9f1eb5c66f5555cee09e876e5	src/internal/__lock.h

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).