Prototype: int sem_post(sem_t *sem);
#include <semaphore.h> sem_t sem; int ret; ret = sem_post(&sem); /* semaphore is posted */
Use sem_post(3R) to atomically increment the semaphore pointed to by sem. When any threads are blocked on the semaphore, one of them is unblocked. (For Solaris threads, see "sema_post(3T)".)
sem_post() returns zero after completing successfully. Any other returned value indicates that an error occurred. When the following condition occurs, the function fails and returns the corresponding value.