sema_wait(3scl)sema_wait(3scl)NAMEsema_wait - Decrement (lock) a semaphore, blocking if necessary.
LIBRARY
SCL Threads Library (libthread.so)
SYNOPSIS
#include <synch.h>
int sema_wait(
sema_t *semp );
PARAMETERS
Pointer to the semaphore to be decremented.
DESCRIPTION
This routine blocks until the semaphore's count is greater than 0, and
then it atomically decrements it.
SCL IMPLEMENTATION NOTESsema_wait(3scl) is implemented by calling sem_wait(3).
Tests on Solaris indicate that sema_wait() does not validate the sema‐
phore parameter. This implementation typically returns EFAULT if the
semaphore is invalid, and writes an error-mapping message to the SCL
errorlog.
RETURN VALUES
If an error condition occurs, this routine returns an integer value
indicating the type of error.
Additional error return information may be written to the SCL error
log. Refer to scl_error_log(4scl) for details.
Possible return values are as follows: Successful completion. A signal
interrupted this function. sem_wait(3) returned EINVAL, meaning that
the semaphore in invalid (un-initialized). An error-mapping message is
written to the SCL errorlog. Or:
An internal implementation error occurred. Refer to the SCL errorlog
for additional information.
Note: EFAULT is not returned if semp is an illegal address. An illegal
address generates a SIGSEGV signal, which by default will abort the
process and generate a core dump.
ERRORS
None.
RELATED INFORMATION
Functions: scl_intro(3scl), scl_thread_intro(3scl), sem_wait(3),
sema_destroy(3scl), sema_init(3scl), sema_post(3scl), sema_try‐
wait(3scl)
Files: scl_error_log(4scl)
Manuals: Solaris Compatibility Libraries User's Guide
sema_wait(3scl)