mutex_trylock(3scl)mutex_trylock(3scl)NAMEmutex_trylock - Attempts to lock the specified mutex, without waiting
if the mutex is already locked.
SCL Threads Library (libthread.so)
mutex_t *mutexp );
Address of the mutex to be locked.
This routine attempts to lock the mutex specified by the mutexp argu‐
ment. When a thread calls this routine, an attempt is made to immedi‐
ately lock the mutex. If the mutex is successfully locked by this
call, this routine returns 0. If the specified mutex is already locked
when a thread calls this routine, the calling thread does not wait for
the mutex to become available but returns EBUSY instead.
SCL IMPLEMENTATION NOTESmutex_trylock(3scl) is implemented by calling pthread_mutex_trylock(3).
mutex_trylock(3scl) first checks to determine if the mutex is valid: if
it is not, then the mutex is initialized for intra-process thread syn‐
chronization (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.
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. The mutex is already locked. Error from
pthread_mutex_init(3) or pthread_mutex_trylock(3). A message is writ‐
ten 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.
Functions: mutex_destroy(3scl), mutex_init(3scl), mutex_lock(3scl),
mutex_unlock(3scl), pthread_mutex_init(3), pthread_mutex_lock(3),
Manuals: Solaris Compatibility Libraries User's Guide