mutex_trylock man page on DigitalUNIX

Printed from

mutex_trylock(3scl)					   mutex_trylock(3scl)

       mutex_trylock  -	 Attempts to lock the specified mutex, without waiting
       if the mutex is already locked.

       SCL Threads Library (

       #include <synch.h>

       int mutex_trylock(
			  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.

       mutex_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),
       scl_intro(3scl), scl_thread_intro(3scl)

       Files: scl_error_log(4scl)

       Manuals: Solaris Compatibility Libraries User's Guide


List of man pages available for DigitalUNIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net