projects
/
oweals
/
musl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
floating point environment, untested
[oweals/musl.git]
/
src
/
thread
/
sem_trywait.c
diff --git
a/src/thread/sem_trywait.c
b/src/thread/sem_trywait.c
index d0e928ef67d2048f4bbf1f1214a30407d8dbe7c8..dd8f57e36a0bd54a60a5b4c21516b9a1b6a8bba5 100644
(file)
--- a/
src/thread/sem_trywait.c
+++ b/
src/thread/sem_trywait.c
@@
-3,9
+3,8
@@
int sem_trywait(sem_t *sem)
{
- int val = a_fetch_add(sem->__val, -1);
- if (val > 0) return 0;
- a_inc(sem->__val);
+ int val = sem->__val[0];
+ if (val>0 && a_cas(sem->__val, val, val-1)==val) return 0;
errno = EAGAIN;
return -1;
}