musl/src/thread/sem_getvalue.c
2011-03-04 00:45:59 -05:00

9 lines
133 B
C

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