*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: sem_post | Section: 3 | Source: Digital UNIX | File: sem_post.3.gz
sem_post(3) Library Functions Manual sem_post(3) NAME sem_post - Unlock a semaphore (P1003.1b) SYNOPSIS #include <semaphore.h> int sem_post ( sem_t *sem); PARAMETERS sem Pointer to the semaphore to be unlocked. DESCRIPTION The sem_post function unlocks the specified semaphore by performing the semaphore unlock operation on that semaphore. The appropriate function (sem_open for named semaphores or sem_init for unnamed semaphores) must be called for a semaphore before you can call the locking and unlocking functions, sem_wait, sem_trywait, and sem_post. If the semaphore value after a sem_post function is positive, no processes were blocked waiting for the semaphore to be unlocked; the semaphore value is incremented. If the semaphore value after a sem_post function is zero, one of the processes blocked waiting for the semaphore is allowed to return successfully from its call to sem_wait. If more than one process is blocked while waiting for the semaphore, only one process is unblocked and the state of the semaphore remains unchanged when the sem_post function returns. The process to be un- blocked is selected according to the scheduling policies and priorities of all blocked processes. If the scheduling policy is SCHED_FIFO or SCHED_RR, the highest priority waiting process is unblocked. If more than one process of that priority is blocked, then the process that has waited the longest amount of time is unblocked. The sem_post function can be called from a signal-catching function. RETURN VALUES On successful completion, the sem_post function returns the value 0 and performs a semaphore unlock operation, unblocking a process. Otherwise, the function returns the value -1 and sets errno to indicate the error. The state of the semaphore remains unchanged. ERRORS The sem_post function fails under the following condition: [EINVAL] The sem does not refer to a valid semaphore. RELATED INFORMATION Functions: sem_trywait(3), sem_wait(3) delim off sem_post(3)

Navigation Options