Home | History | Annotate | Download | only in pthread_mutexattr_settype
      1 <assertions>
      2   <assertion id="1" tag="ref:XSH6:34497:34499">
      3    The function
      4 
      5    int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
      6 
      7   Sets the mutex 'type' attribute.  This attribute is set in the 'type' parameter to
      8   these functions.  The default value is PTHREAD_MUTEX_DEFAULT.
      9 
     10   </assertion>
     11   <assertion id="2" tag="ref:XSH6:34503:34506">
     12   PTHREAD_MUTEX_NORMAL
     13 
     14   This type of mutex doesn't detect deadlock.  So a thread attempting to relock this mutex
     15   without unlocking it first will deadllock.  Attempting to unlock a mutex locked by a
     16   different thread results in undefined behavior.  Attemping to unlock an unlocked mutex
     17   results in undefined behavior.
     18   </assertion>
     19   <assertion id="3" tag="ref:XSH6:34507:i34511">
     20   PTHREAD_MUTEX_ERRORCHECK
     21 
     22   Provides errorchecking.  A thread attempting to relock this mutex without unlocking it
     23   first will return with an error.  A thread attempting to unlock a mutex which another
     24   thread has locked will return with an error.  A thread attempting to unlock an unlocked
     25   mutex will return with an error.
     26   </assertion>
     27   <assertion id="5" tag="ref:XSH6:34520:34525">
     28   PTHREAD_MUTEX_DEFAULT
     29 
     30   Attempting to recursively lock a mutex of this type will result in undefined behavior.
     31   Attempting to unlock a mutex of this type which was not locked by the calling thread
     32   results in undefined behavior.  Attempting to unlock a mutex of this type which is
     33   locked results in undefined behavior.  An implementation may map this mutex to one of
     34   the other mutex types.
     35   </assertion>
     36   <assertion id="6" tag="ref:XSH6:34526:34529">
     37   It returns 0 upon success.
     38   </assertion>
     39   <assertion id="7" tag="ref:XSH6:34532:34537">
     40   It shall fail if:
     41 
     42   [EINVAL] - The value 'type' is invalid.
     43 
     44   It may fail if:
     45 
     46   [EINVAL] - The value specified by 'attr' is invalid.
     47 
     48   It shall not return an error code of [EINTR].
     49   </assertion>
     50 </assertions>
     51