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