Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #842
Difficulty: Medium
HTTP server push (also known as HTTP streaming) is a mechanism for sending unsolicited (asynchronous) data from a web server to a web browser.
True or False?
Linux & Unix Commands - Search Man Pages

sem_post(3) [bsd man page]

SEM_POST(3)						     Linux Programmer's Manual						       SEM_POST(3)

sem_post - unlock a semaphore SYNOPSIS
#include <semaphore.h> int sem_post(sem_t *sem); Link with -pthread. DESCRIPTION
sem_post() increments (unlocks) the semaphore pointed to by sem. If the semaphore's value consequently becomes greater than zero, then another process or thread blocked in a sem_wait(3) call will be woken up and proceed to lock the semaphore. RETURN VALUE
sem_post() returns 0 on success; on error, the value of the semaphore is left unchanged, -1 is returned, and errno is set to indicate the error. ERRORS
EINVAL sem is not a valid semaphore. EOVERFLOW The maximum allowable value for a semaphore would be exceeded. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-----------+---------------+---------+ |Interface | Attribute | Value | +-----------+---------------+---------+ |sem_post() | Thread safety | MT-Safe | +-----------+---------------+---------+ CONFORMING TO
sem_post() is async-signal-safe: it may be safely called within a signal handler. EXAMPLE
See sem_wait(3). SEE ALSO
sem_getvalue(3), sem_wait(3), sem_overview(7), signal-safety(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at Linux 2017-03-13 SEM_POST(3)

Check Out this Related Man Page

sem_post(3)						     Library Functions Manual						       sem_post(3)

sem_post - Unlocks a semaphore (P1003.1b) LIBRARY
Realtime Library (, librt.a) 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 func- tion (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 sema- phore value is incremented. If the semaphore value after a sem_post function is zero, one of the processes blocked waiting for the sema- phore 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 unblocked 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 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 (zero) 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) Guide to Realtime Programming delim off sem_post(3)

Featured Tech Videos