Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/sem_wait.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/sem_wait.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/sem_wait.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/sem_wait.html on line 8
Wait on a semaphore
#include <semaphore.h>
int sem_wait( sem_t * sem );
- sem
- A pointer to the sem_t object for the semaphore that
you want to wait on.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The sem_wait() function decrements the semaphore referred to by
the sem argument. If the semaphore value is not greater than
zero, then the calling process blocks until it can decrement
the counter, or the call is interrupted by signal.
Some process should eventually call
sem_post()
to
increment the semaphore.
- 0
- The semaphore was successfully decremented.
- -1
- The state of the semaphore is unchanged
(errno is set).
- EDEADLK
- A deadlock condition was detected.
- EINVAL
- Invalid semaphore descriptor sem.
- EINTR
- A signal interrupted this function.
POSIX 1003.1 SEM
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
sem_destroy(),
sem_init(),
sem_post(),
sem_trywait()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/sem_wait.html on line 146
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/sem_wait.html on line 146