The pthread_mutex_timedlock() function return 0 if it locks the mutex successfully. Otherwise, an error number is returned to indicate the error.
The mutex was created with the protocol attribute having the value PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than the mutex's current priority ceiling.Description:
The value specified by mutex does not refer to an initialized mutex object.Description:
The process or thread would have blocked, and the abs_timeout parameter specified a nanoseconds field value less than 0 or greater than or equal to 1000 million.
The mutex could not be locked before the specified timeout expired.
See the discussion in pthread_mutex_lock Return Values.