SEM_POST(2) BSD System Calls Manual SEM_POST(2)NAME
sem_post -- unlock a semaphore
The semaphore referenced by sem is unlocked, the value of the semaphore is incremented, and all threads which are waiting on the semaphore
sem_post() is reentrant with respect to signals and may be called from within a signal hanlder.
If successful, sem_post() will return 0. Otherwise, -1 is returned and errno is set.
sem_post() succeeds unless:
[EINVAL] sem is not a valid semaphore descriptor.
SEE ALSO sem_open(2), sem_trywait(2), sem_wait(2), semctl(2), semget(2), semop(2)HISTORY
sem_post() is specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995).
Darwin June 8, 2000 Darwin
Check Out this Related Man Page
SEM_POST(3) Linux Programmer's Manual SEM_POST(3)NAME
sem_post - unlock a semaphore
int sem_post(sem_t *sem);
Link with -lrt or -pthread.
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.
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
EINVAL sem is not a valid semaphore.
The maximum allowable value for a semaphore would be exceeded.
sem_post() is async-signal-safe: it may be safely called within a signal handler.
SEE ALSO sem_getvalue(3), sem_wait(3), sem_overview(7)COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2009-03-30 SEM_POST(3)
I have written this small program using the concept of semaphores. I am a bit confused, hope u can help me with it.
The idea is that
1. Two threads are created
2. First will be displaying 0(zero) on the screen
3. Second will be displaing 1(one) on the screen
4. This process... (2 Replies)
I am using semaphores in my program, but when I compile the program, it gives the following error
$ gcc sem.c -o sem -lpthread
Undefined first referenced
symbol in file
sem_init ... (1 Reply)
if there are many processes running and I initialize the semaphore like this:
my_sem = sem_open(SEM_NAME, O_CREAT | O_RDWR,
S_IRUSR | S_IWUSR, 10);
(the last argument is 10)
and then i use
Will 10 processes be able to access the... (1 Reply)