summaryrefslogblamecommitdiff
path: root/src/thread/sem_getvalue.c
blob: 643c096877b9ee7c1dde3dc679828d58375f96be (plain) (tree)
1
2
3
4
5
6
7
8







                                       
#include <semaphore.h>

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