pthread_mutexattr_getrobust(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

pthread_mutexattr_getrobust(3c)

pthread_...getrobust(3C) Standard C Library Functions pthread_...getrobust(3C)

NAME
       pthread_mutexattr_getrobust,  pthread_mutexattr_setrobust - get and set
       the mutex robust attribute

SYNOPSIS
       #include <pthread.h>

       int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr,
            int *robust);


       int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr,
            int robust);

DESCRIPTION
       The  pthread_mutexattr_getrobust()  and   pthread_mutexattr_setrobust()
       functions,  respectively,  get and set the mutex robust attribute. This
       attribute is set in the robust parameter. Valid values for  robust  in‐
       clude:

       PTHREAD_MUTEX_STALLED

           No  special  actions  are taken if the owner of the mutex is termi‐
           nated while holding the mutex lock. This can lead to deadlocks  be‐
           cause  no  other  thread  can unlock the mutex. This is the default
           value.


       PTHREAD_MUTEX_ROBUST

           If the owning thread of a robust mutex terminates while holding the
           mutex lock, or if the process containing the owning thread of a ro‐
           bust mutex terminates, either normally or  abnormally,  or  if  the
           process  containing  the  owner of the mutex unmaps the memory con‐
           taining the mutex or performs one of  the  exec(2)  functions,  the
           next  thread that acquires the mutex will be notified by the return
           value EOWNERDEAD from the locking function.

           The notified thread can then attempt to recover the state protected
           by the mutex and, if successful, mark the state as consistent again
           by a call to pthread_mutex_consistent(). After  a  subsequent  suc‐
           cessful  call  to  pthread_mutex_unlock(3C), the mutex lock will be
           released and can be used normally by other threads. If the mutex is
           unlocked without a call to pthread_mutex_consistent(), it  will  be
           in  a permanently unusable state and all attempts to lock the mutex
           will fail with the error ENOTRECOVERABLE. The only permissible  op‐
           eration on such a mutex is pthread_mutex_destroy(3C).

           The  actions required to make the state protected by the mutex con‐
           sistent  are  solely  dependent   on   the   application.   Calling
           pthread_mutex_consistent(3C)  does  not,  by itself, make the state
           protected by the mutex consistent.

           The behavior is undefined if the value specified by the attr  argu‐
           ment  to  pthread_mutexattr_getrobust() or pthread_mutexattr_setro‐
           bust() does not refer to an initialized mutex attributes object.


RETURN VALUES
       Upon successful completion, the pthread_mutexattr_getrobust()  function
       returns 0 and stores the value of the robust attribute of attr into the
       object referenced by the robust parameter. Otherwise, an error value is
       returned to indicate the error.


       Upon  successful completion, the pthread_mutexattr_setrobust() function
       returns 0. Otherwise, an error value is returned to indicate the error.

ERRORS
       The pthread_mutexattr_setrobust() function will fail if:

       EINVAL    The value of robust is invalid.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE  VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe _ Stan‐
       dardSee standards(7).


SEE ALSO
       exec(2),    pthread_mutex_consistent(3C),    pthread_mutex_destroy(3C),
       pthread_mutex_init(3C),    pthread_mutex_lock(3C),    pthread_mutex_un‐
       lock(3C), pthread_mutexattr_getpshared(3C), pthread_mutexattr_init(3C),
       attributes(7), mutex(7), standards(7)

NOTES
       The mutex memory must be zeroed before first initialization of a  mutex
       with  the PTHREAD_MUTEX_ROBUST attribute. Any thread in any process in‐
       terested in the robust lock can  call  pthread_mutex_init()  to  poten‐
       tially  initialize  it,  provided  that all such callers of pthread_mu‐
       tex_init() specify the same set of attributes in their attribute struc‐
       tures. In this situation, if pthread_mutex_init() is called on a previ‐
       ously initialized robust mutex, it will not reinitialize the mutex  and
       will return the error value EBUSY. If pthread_mutex_init() is called on
       a  previously  initialized  robust mutex, and if the caller specifies a
       different set of attributes from those already in effect for the mutex,
       it will not reinitialize the mutex and will return the error value EIN‐
       VAL.

Oracle Solaris 11.4               16 May 2014         pthread_...getrobust(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3