Index of Section 2 Manual Pages
| Interix / SUA | pthread_mutex_timedlock.2 | Interix / SUA |
pthread_mutex_timedlock(2) pthread_mutex_timedlock(2)
pthread_mutex_timedlock()
NAME
pthread_mutex_timedlock() - lock a mutex with expiration time
SYNOPSIS
#include
int pthread_mutex_timedlock(pthread_mutex_t *mutex,
pthread_timespec *abstime);
DESCRIPTION
The pthread_mutex_timedlock(2) locks the mutex referenced by the mutex
argument. If the mutex is already locked, the calling thread is blocked
until the mutex becomes available, as with the pthread_mutex_lock(2)
function. If the mutex cannot be locked because another thread has the
mutex locked, the block ends when the system clock reaches the time
referenced by the abstime argument, or if the time has already passed when
the call is made.
RETURN VALUES
On success, the function returns 0; otherwise, an error code is returned.
ERRORS
The pthread_mutex_timedlock() function can fail for the following reasons:
[EAGAIN]
The mutex could not be locked because the maximum number of locks on
the mutex has been reached.
[EDEADLK]
The calling thread already owns the mutex.
[EINVAL]
The mutex was created with the protocol attribute set to
PTHREAD_PRIO_PROTECT and the calling thread's priority is higher than
the mutex's current priority ceiling.
The process or thread would have blocked, and the abstime argument
specifies a value in nanoseconds less than zero or greater than or
equal to 1000 million.
The mutex argument does not refer to a valid mutex object.
[ETIMEDOUT]
The mutex could not be locked before the specified time passed.
This function does not return [EINTR].
SEE ALSO
pthread_mutex_destroy(2)
pthread_mutex_lock(2)
time(2)
USAGE NOTES
The pthread_mutex_timedlock function is thread safe.
The pthread_mutex_timedlock function is not async-signal safe.