1 <assertions> 2 <assertion id="1" tag="ref:XSH6:34022:34029"> 3 The function 4 5 int pthread_mutex_timedlock(pthread_mutex_t *restrict mutex, 6 const struct timespec *restrict abs_timeout); 7 8 locks the mutex object referenced by 'mutex'. If the mutex is 9 already locked, the calling thread shall block until the mutex becomes 10 available. The wait will end when the specified timeout time has expired. 11 12 The timeout expires when the absolute time 'abs_timeout' passes, or if 'abs_timeout' 13 has already been passed the time of the call. 14 </assertion> 15 16 <assertion id="2" tag="ref:XSH6:34030:34032"> 17 If the Timers option (TMR) is supported, the timeout will be based on the CLOCK_REALTIME 18 clock. Otherwise, it will be based on the system clock as returned by time() 19 </assertion> 20 <assertion id="3" tag="ref:XSH6:34038:34041"> 21 For mutexes initialized with the PRIO_INHERIT protocol, if a timed mutex wait is 22 terminated because its timeout expired, the priority of the owner of the mutex shall be 23 adjusted to show the fact that this thread no longer is among those that are waiting for 24 the mutex. 25 </assertion> 26 <assertion id="4" tag="ref:XSH6:34043:34044"> 27 Upon success, it returns 0. 28 </assertion> 29 <assertion id="5" tag="ref:XSH6:34046:34059"> 30 It SHALL fail if: 31 32 [EINVAL] - The mutex was created with the protocol attribute of 33 PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than 34 the mutex's current priority ceiling. 35 36 [EINVAL] - The process or thread would have blocked, and the abs_timeout parameter 37 specified in nano-seconds field value is less than 0 or greater than or equal 38 to 1,000 million. 39 40 [ETIMEDOUT] - The timeout expried and the mutex could not be locked. 41 42 It MAY fail if: 43 44 [EVINAL] - 'mutex' does not refer to an initialized mutex object. 45 46 [EAGAIN] - (XSI) The mutex could not be acquired, the max number of recursive locks for 47 'mutex' has been exceeded. 48 49 [EDEADLK] - The current thread already owns the mutex. 50 </assertion> 51 </assertions> 52