45#define SEM_FAILED ((sem_t *) 0)
#define ENOENT
No such file or directory.
#define EINVAL
Invalid argument.
#define ENOMEM
Not enough space.
int errno
number of last error
#define SEM_FAILED
Value returned if ‘sem_open’ failed.
static int sem_unlink(const char *name)
Remove named semaphore name.
static int sem_getvalue(sem_t *sem, int *sval)
Get current value of sem and store it in sval.
sema_t sem_t
POSIX-specific semaphore type.
static int sem_init(sem_t *sem, int pshared, unsigned value)
Initialize an unnamed semaphore.
static int sem_trywait(sem_t *sem)
Test whether sem is posted.
static sem_t * sem_open(const char *name, int oflag,...)
Open a named semaphore name with open flags oflag.
int sem_timedwait(sem_t *sem, const struct timespec *abstime)
Similar to ‘sem_wait’ but wait only until abstime.
static int sem_destroy(sem_t *sem)
destroy an unnamed semaphore
static int sem_post(sem_t *sem)
Unlock a semaphore.
static int sem_wait(sem_t *sem)
Lock a semaphore.
static int sem_close(sem_t *sem)
Close descriptor for named semaphore sem.
void sema_create(sema_t *sema, unsigned int value)
Creates semaphore dynamically.
static int sema_wait(sema_t *sema)
Wait for a semaphore being posted (without timeout).
void sema_destroy(sema_t *sema)
Destroys a semaphore.
static unsigned sema_get_value(const sema_t *sema)
Get a semaphore's current value.
static int sema_try_wait(sema_t *sema)
Test if the semaphore is posted.
int sema_post(sema_t *sema)
Signal semaphore.