1<assertions> 2 <assertion id="1" tag="ref:XSH6:33638:33640"> 3 The function 4 5 int pthread_mutex_init(pthread_mutex_t *restrict mutex, 6 const pthread_mutexattr_t *restrict attr); 7 8 pthread_mutex_t = PHTREAD_MUTEX_INITIALIZER 9 10 initializes a mutex referenced by 'mutex' with attributes specified by 11 'attr'. If 'attr' is NULL, the default mutex attributes are used. The 12 effect shall be the same as passing the address of a default mutex attributes 13 object. 14 </assertion> 15 <assertion id="2" tag="ref:XSH6:33640:33645"> 16 Upon successful initialization, the state of the mutex becomes initialized 17 and unlocked. Attempting to initialize an already intialized mutex 18 results in undefined behavior. 19 </assertion> 20 <assertion id="3" tag="ref:XSH6:33646:33649"> 21 In cases where default mutex attributes are appropriate, the macro 22 PTHREAD_MUTEX_INITIALIZER can be used to intiailize mutexes that are 23 statically allocated. The effect shall be equivilant to dynamic 24 intialization by a call to pthread_mutex_init() with paramter 'attr' 25 specified as NULL, except that no error checks are performed. 26 </assertion> 27 <assertion id="4" tag="ref:XSH6:33651:33651"> 28 Upon success, it returns a 0; 29 </assertion> 30 <assertion id="5" tag="ref:XSH6:33662:33671"> 31 It SHALL fail if: 32 33 -[EAGAIN] The system lacked the neccessary resources (other than memory) 34 to intialize another mutex. 35 -[ENOMEM] Insufficient memory exists to initialize the mutex. 36 -[EPERM] The caller does not have the privilage to perform the operation. 37 38 It MAY fail if: 39 40 -[EBUSY] The implementation has detected an attempt to reinitialize the 41 object referenced by 'mutex', a previously intialized, but not yet 42 destroyed, mutex. 43 -[EINVAL] The value specified by 'attr' is invalid. 44 45 It shall not return [EINTR] 46 </assertion> 47</assertions> 48