musl-tcc/src/thread/sem_getvalue.c
2022-03-20 16:48:53 +08:00

9 lines
151 B
C

#include <semaphore.h>
int sem_getvalue(sem_t *restrict sem, int *restrict valp)
{
int val = sem->__val[0];
*valp = val < 0 ? 0 : val;
return 0;
}