cond_wait man page on DigitalUNIX

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
DigitalUNIX logo
[printable version]

cond_wait(3scl)						       cond_wait(3scl)

       cond_wait  -  Causes a thread to wait for the specified condition vari‐
       able to be signaled or broadcasted.

       SCL Threads Library (

       #include <synch.h>

       int cond_wait(
		      cond_t  *condp,
		      mutex_t *mutexp );

       Address of the condition variable that the  calling  thread  waits  on.
       Address	of  the mutex associated with the condition variable specified
       by condp.

       This routine causes a thread to wait for the specified condition	 vari‐
       able to be signaled or broadcasted.

       This  routine  should  be  called  with the specified mutex locked. The
       results of this routine are unpredictable if  this  routine  is	called
       without first locking the mutex.

       This routine atomically unlocks the mutex and causes the calling thread
       to wait on the condition. The atomicity is important, because it	 means
       the thread cannot miss a wakeup while the mutex is being unlocked. When
       the wait is  satisfied  as  a  result  of  some	other  thread  calling
       pthread_cond_signal(3)  or  pthread_cond_broadcast(3), the mutex is re-
       locked before returning to the caller.

       cond_wait(3scl) is implemented by calling pthread_cond_wait(3).

       Before calling pthread_cond_wait(3), this routine first checks  whether
       the  condition  variable and mutex are valid: if not, then this routine
       initializes them for intra-process use (type USYNC_THREAD)  by  calling
       pthread_cond_init(3)  and/or pthread_mutex_init(3). If the mutex needed
       initializing, then  this	 routine  also	locks  the  mutex  by  calling
       pthread_mutex_lock(3).  This  action  matches the observed behaviour of

       Solaris documents  that	cond_wait()  always  returns  with  the	 mutex
       locked,	even when returning an error. This is not necessarily the case
       with the SCL implementation, if, for example, the  specified  mutex  is
       invalid,	 and  the  attempt  to initialize the mutex, and then lock it,
       fails. The best we can say is that if cond_wait(3scl)  is  called  with
       valid  condp  and  mutexp  parameters,  and  with the mutex locked, and
       cond_wait(3scl) returns 0, then the caller is assured that the mutex is
       now locked. The state of the mutex for any other status return is unde‐
       fined in this implementation.

       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.   An
       internal	 implementation	 error occurred. Refer to the SCL errorlog for
       additional information.

       Note: EFAULT is not returned if condp or mutexp is an illegal  address.
       An  illegal  address  generates a SIGSEGV signal, which by default will
       abort the process and generate a core dump.


       Functions: cond_broadcast(3scl),	 cond_destroy(3scl),  cond_init(3scl),
       cond_signal(3scl),      cond_timedwait(3scl),	 pthread_cond_init(3),
       pthread_cond_wait(3),   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