author | Rich Felker <dalias@aerifal.cx> | 2020年05月21日 23:32:45 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020年05月22日 17:39:57 -0400 |
commit | e01b5939b38aea5ecbe41670643199825874b26c (patch) | |
tree | 100e5d227741abd1653158b2e236ba3c24621113 /src | |
parent | 4d5aa20a94a2d3fae3e69289dc23ecafbd0c16c4 (diff) | |
download | musl-e01b5939b38aea5ecbe41670643199825874b26c.tar.gz |
-rw-r--r-- | src/internal/libc.h | 2 | ||||
-rw-r--r-- | src/malloc/malloc.c | 2 | ||||
-rw-r--r-- | src/thread/__lock.c | 2 |
diff --git a/src/internal/libc.h b/src/internal/libc.h index ac97dc7e..c0614852 100644 --- a/src/internal/libc.h +++ b/src/internal/libc.h @@ -21,7 +21,7 @@ struct __libc { int can_do_threads; int threaded; int secure; - volatile int threads_minus_1; + int threads_minus_1; size_t *auxv; struct tls_module *tls_head; size_t tls_size, tls_align, tls_cnt; diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c index 96982596..2553a62e 100644 --- a/src/malloc/malloc.c +++ b/src/malloc/malloc.c @@ -26,7 +26,7 @@ int __malloc_replaced; static inline void lock(volatile int *lk) { - if (libc.threads_minus_1) + if (libc.threaded) while(a_swap(lk, 1)) __wait(lk, lk+1, 1, 1); } diff --git a/src/thread/__lock.c b/src/thread/__lock.c index 45557c88..5b9b144e 100644 --- a/src/thread/__lock.c +++ b/src/thread/__lock.c @@ -18,7 +18,7 @@ void __lock(volatile int *l) { - if (!libc.threads_minus_1) return; + if (!libc.threaded) return; /* fast path: INT_MIN for the lock, +1 for the congestion */ int current = a_cas(l, 0, INT_MIN + 1); if (!current) return; |