mailing list of musl libc
 help / color / mirror / code / Atom feed
a96d159fa890d6681158b66ecfaea9fa31e4265b blob 928 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
 
#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 holding the lock, +1 to count this
           thread in the critical section. */
	int current = a_cas(l, 0, INT_MIN + 1);
        if (!current) return;
        __lock_slow(l, current);
}

static inline void __unlock_fast(volatile int *l)
{
	/* We have to check if l[0] had been touched at all. */
	if (l[0] < 0) {
		if (a_fetch_add(l, -(INT_MIN + 1)) != (INT_MIN + 1)) {
			__wake(l, 1, 1);
		}
	}
}

static inline void __unlock_requeue_fast(volatile int *l, volatile int *r, int shared)
{
	extern void __unlock_requeue_slow(volatile int*, volatile int*, int);
	/* We have to check if l[0] had been touched at all. */
	if (l[0] < 0 && (a_fetch_add(l, -(INT_MIN + 1)) != (INT_MIN + 1)))
          __unlock_requeue_slow(l, r, shared);
}
debug log:

solving a96d159f ...
found a96d159f in https://inbox.vuxu.org/musl/d42e6a32e05b15ffd0279eca8505d495b86e5874.1498228733.git.Jens.Gustedt@inria.fr/
found c1f07fc0 in https://inbox.vuxu.org/musl/0ec8d5597db7fcc1090b7b2120e3d441624db68c.1498228733.git.Jens.Gustedt@inria.fr/

applying [1/2] https://inbox.vuxu.org/musl/0ec8d5597db7fcc1090b7b2120e3d441624db68c.1498228733.git.Jens.Gustedt@inria.fr/
diff --git a/src/internal/__lock.h b/src/internal/__lock.h
new file mode 100644
index 00000000..c1f07fc0


applying [2/2] https://inbox.vuxu.org/musl/d42e6a32e05b15ffd0279eca8505d495b86e5874.1498228733.git.Jens.Gustedt@inria.fr/
diff --git a/src/internal/__lock.h b/src/internal/__lock.h
index c1f07fc0..a96d159f 100644

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

index at:
100644 a96d159fa890d6681158b66ecfaea9fa31e4265b	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).