projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
debloat: use __syscall instead of syscall where possible
[oweals/musl.git]
/
src
/
thread
/
sem_trywait.c
1
#include <semaphore.h>
2
#include "pthread_impl.h"
3
4
int sem_trywait(sem_t *sem)
5
{
6
int val = sem->__val[0];
7
if (val>0 && a_cas(sem->__val, val, val-1)==val) return 0;
8
errno = EAGAIN;
9
return -1;
10
}