MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Standard C Library Functions                pthreadcondinit(3C)



NAME
     pthreadcondinit, pthreadconddestroy - initialize or des-
     troy condition variables

SYNOPSIS
     cc -mt [ flag... ] file... -lpthread [ library... ]
     #include 

     int pthreadcondinit(pthreadcondt *restrict cond,
          const pthreadcondattrt *restrict attr);


     int pthreadconddestroy(pthreadcondt *cond


     pthreadcondt cond= PTHREADCONDINITIALIZER;


DESCRIPTION
     The function pthreadcondinit() initializes  the  condition
     variable  referenced  by  cond with attributes referenced by
     attr. If attr  is   NUL,  the  default  condition  variable
     attributes  are  used; the effect is the same as passing the
     address of a default condition variable  attributes  object.
     See  pthreadcondattrinit(3C).  Upon successful initializa-
     tion, the state of the condition variable  becomes  initial-
     ized.


     Attempting to initialize an  already  initialized  condition
     variable results in undefined behavior.


     The function pthreadconddestroy() destroys the given  con-
     dition  variable  specified  by cond; the object becomes, in
     effect,   uninitialized.   An   implementation   may   cause
     pthreadconddestroy()  to set the object referenced by cond
     to an invalid value. A destroyed condition  variable  object
     can be re-initialized using pthreadcondinit(); the results
     of otherwise referencing the object after it has  been  des-
     troyed are undefined.


     It is safe to destroy an initialized condition variable upon
     which  no  threads are currently blocked. Attempting to des-
     troy a condition  variable  upon  which  other  threads  are
     currently blocked results in undefined behavior.


     In cases where default  condition  variable  attributes  are
     appropriate, the macro  PTHREADCONDINITIALIZER can be used
     to  initialize  condition  variables  that  are   statically



SunOS 5.11          Last change: 23 Mar 2005                    1






Standard C Library Functions                pthreadcondinit(3C)



     allocated.  The  effect is equivalent to dynamic initializa-
     tion by a call to pthreadcondinit()  with  parameter  attr
     specified  as   NUL,  except  that no error checks are per-
     formed.

RETURN VALUES
     If     successful,     the      pthreadcondinit()      and
     pthreadconddestroy()  functions  return   0. Otherwise, an
     error number is returned to indicate the  error.  The  EBUSY
     and EINVAL error checks, if implemented, act as if they were
     performed immediately at the beginning of processing for the
     function  and  caused an error return prior to modifying the
     state of the condition variable specified by cond.

ERORS
     The  pthreadcondinit() function will fail if:

     EAGAIN    The system lacked the necessary  resources  (other
               than memory) to initialize another condition vari-
               able.


     ENOMEM    Insufficient memory exists to initialize the  con-
               dition variable.



     The pthreadcondinit() function may fail if:

     EBUSY     The implementation has detected an attempt to  re-
               initialize the object referenced by cond, a previ-
               ously initialized, but not yet  destroyed,  condi-
               tion variable.


     EINVAL    The value specified by attr is invalid.



     The pthreadconddestroy() function may fail if:

     EBUSY     The implementation has detected an attempt to des-
               troy  the  object  referenced  by cond while it is
               referenced (for example, while  being  used  in  a
               pthreadcondwait()  or  pthreadcondtimedwait())
               by another thread.


     EINVAL    The value specified by cond is invalid.






SunOS 5.11          Last change: 23 Mar 2005                    2






Standard C Library Functions                pthreadcondinit(3C)



ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Interface Stability          Standard                    
    
     MT-Level                     MT-Safe                     
    


SEE ALSO
     pthreadcondsignal(3C),         pthreadcondbroadcast(3C),
     pthreadcondwait(3C),           pthreadcondtimedwait(3C),
     pthreadcondattrinit(3C),   attributes(5),    condition(5),
     standards(5)



































SunOS 5.11          Last change: 23 Mar 2005                    3



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™