Index of Section 2 Manual Pages
| Interix / SUA | sem_post.2 | Interix / SUA |
sem_post(2) sem_post(2)
sem_post()
NAME
sem_post() - unlock a semaphore
SYNOPSIS
#include
int sem_post(sem_t *sem);
DESCRIPTION
The sem_post(2) function unlocks the semaphore referenced by the sem
argument. If the value of the semaphore resulting from the operation is
positive, then no threads were blocked waiting for the semaphore to become
unblocked, and so the value of the semaphore was incremented. If, as a
result of this operation, the semaphore value is zero, then one of the
threads waiting for the semaphore is allowed to run successfully from its
call to the sem_wait(2) function.
RETURN VALUES
On success, the function returns 0; otherwise, -1 is returned and errno is
set to an error code to indicate the error.
ERRORS
The sem_post() function can fail for the following reason:
[EINVAL]
The sem argument does not refer to a valid semaphore.
SEE ALSO
semctl(2)
semget(2)
semop(2)
sem_timedwait(2)
sem_trywait(2)
sem_wait(2)
USAGE NOTES
The sem_post function is thread safe.
The sem_post function is async-signal safe.