mutex_lock(3scl)mutex_lock(3scl)NAMEmutex_lock - Locks an unlocked mutex, blocking if necessary.
LIBRARY
SCL Threads Library (libthread.so)
SYNOPSIS
#include <synch.h>
int mutex_lock(
mutex_t *mutexp );
PARAMETERS
Address of the mutex to be locked.
DESCRIPTION
This routine locks the specified mutex. If the mutex is already locked,
then this thread will wait (block) until it can lock the mutex.
SCL IMPLEMENTATION NOTESmutex_lock(3scl) is implemented by calling pthread_mutex_lock(3).
mutex_lock(3scl) first checks to determine if the mutex is valid: if it
is not, then the mutex is initialized for intra-process thread synchro‐
nization (type USYNC_THREAD) by calling pthread_mutex_init(3).
Note that because this implementation of the Solaris Compatibility
Libraries does not support USYNC_PROCESS_ROBUST mutexes, that the
return-statuses of EOWNERDEAD, ELOCKUNMAPPED, and ENOTRECOVERABLE are
not possible from this routine.
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. Error from pthread_mutex_init(3) or
pthread_mutex_lock(3). A message is written to the SCL errorlog which
outlines the error-code mapping. Or:
An internal implementation error occurred. Refer to the SCL errorlog
for additional information.
Note: EFAULT is not returned if mutexp is an illegal address. An ille‐
gal address generates a SIGSEGV signal, which by default will abort the
process and generate a core dump.
ERRORS
None.
RELATED INFORMATION
Functions: mutex_destroy(3scl), mutex_init(3scl), mutex_trylock(3scl),
mutex_unlock(3scl), pthread_mutex_init(3), pthread_mutex_lock(3),
scl_intro(3scl), scl_thread_intro(3scl)
Files: scl_error_log(4scl)
Manuals: Solaris Compatibility Libraries User's Guide
mutex_lock(3scl)