projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
report that posix_spawn is supported in unistd.h and sysconf
[musl]
/
src
/
thread
/
pthread_once.c
diff --git
a/src/thread/pthread_once.c
b/src/thread/pthread_once.c
index
7223005
..
41872f1
100644
(file)
--- a/
src/thread/pthread_once.c
+++ b/
src/thread/pthread_once.c
@@
-20,7
+20,13
@@
int pthread_once(pthread_once_t *control, void (*init)(void))
for (;;) switch (a_swap(control, 1)) {
case 0:
for (;;) switch (a_swap(control, 1)) {
case 0:
- break;
+ pthread_cleanup_push(undo, control);
+ init();
+ pthread_cleanup_pop(0);
+
+ a_store(control, 2);
+ if (waiters) __wake(control, -1, 0);
+ return 0;
case 1:
__wait(control, &waiters, 1, 0);
continue;
case 1:
__wait(control, &waiters, 1, 0);
continue;
@@
-28,11
+34,4
@@
int pthread_once(pthread_once_t *control, void (*init)(void))
a_store(control, 2);
return 0;
}
a_store(control, 2);
return 0;
}
-
- pthread_cleanup_push(undo, control);
- init();
- pthread_cleanup_pop(0);
-
- if (waiters) __wake(control, -1, 0);
- return 0;
}
}