Visit The New, Modern Unix Linux Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #908
Difficulty: Medium
If a Unix shell command line ends with the hashtag #, then the job runs in the background, and the shell does not wait for the job to terminate before printing the prompt and waiting for the next command line.
True or False?
Linux & Unix Commands - Search Man Pages

sem_post(2) [mojave man page]

SEM_POST(2)						      BSD System Calls Manual						       SEM_POST(2)

sem_post -- unlock a semaphore SYNOPSIS
#include <semaphore.h> int sem_post(sem_t *sem); DESCRIPTION
The semaphore referenced by sem is unlocked, the value of the semaphore is incremented, and all threads which are waiting on the semaphore are awakened. 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. ERRORS
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)

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. 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) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at Linux 2012-05-13 SEM_POST(3)

3 More Discussions You Might Find Interesting

1. Programming

sem_wait, sem_post confusion?

Hi friends, 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)
Discussion started by: gabam
2 Replies

2. Programming

Undefined: sem_init, sem_post, sem_wait

Hi friends, 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)
Discussion started by: gabam
1 Replies

3. Homework & Coursework Questions

Semaphores sem_wait sem_post problem

hallo! 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 sem_wait(my_sem); sleep(5); sem_post; Will 10 processes be able to access the... (1 Reply)
Discussion started by: whatevernever
1 Replies

Featured Tech Videos