projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix namespace violation in sys/shm.h
[musl]
/
src
/
thread
/
__lock.c
diff --git
a/src/thread/__lock.c
b/src/thread/__lock.c
index
2f345ae
..
0874c04
100644
(file)
--- a/
src/thread/__lock.c
+++ b/
src/thread/__lock.c
@@
-2,11
+2,14
@@
void __lock(volatile int *l)
{
void __lock(volatile int *l)
{
- while (a_swap(l, 1)) __wait(l, l+1, 1, 1);
+ if (libc.threads_minus_1)
+ while (a_swap(l, 1)) __wait(l, l+1, 1, 1);
}
void __unlock(volatile int *l)
{
}
void __unlock(volatile int *l)
{
- a_store(l, 0);
- if (l[1]) __wake(l, 1, 1);
+ if (l[0]) {
+ a_store(l, 0);
+ if (l[1]) __wake(l, 1, 1);
+ }
}
}