*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: pthread_mutex_lock | Section: 3 | Source: OpenBSD | File: pthread_mutex_lock.3
PTHREAD_MUTEX_LOCK(3) FreeBSD Library Functions Manual PTHREAD_MUTEX_LOCK(3) NAME pthread_mutex_lock, pthread_mutex_timedlock, pthread_mutex_trylock - lock a mutex SYNOPSIS #include <pthread.h> int pthread_mutex_lock(pthread_mutex_t *mutex); int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime); int pthread_mutex_trylock(pthread_mutex_t *mutex); DESCRIPTION The pthread_mutex_lock() function locks mutex. If the mutex is currently locked by another thread, the calling thread will block until the mutex becomes available. If the mutex is currently locked by the calling thread, then the behavior depends on the type of the mutex. If mutex is of type PTHREAD_MUTEX_NORMAL, then the calling thread will deadlock and never return from pthread_mutex_lock(). If mutex is of type PTHREAD_MUTEX_ERRORCHECK, then EDEADLK is immediately returned. If mutex is of type PTHREAD_MUTEX_RECURSIVE, then the recursion count on the mutex is incremented. The pthread_mutex_timedlock() function locks mutex like pthread_mutex_lock() except that it will not block or deadlock past the system time specified in abstime. If that time is reached without being able to lock mutex, then it returns ETIMEDOUT. The pthread_mutex_trylock() function locks mutex like pthread_mutex_lock() except that if mutex is locked by another thread, or is locked by the calling thread and is not of type PTHREAD_MUTEX_RECURSIVE, then it will immediately return EBUSY. RETURN VALUES If successful, pthread_mutex_lock(), pthread_mutex_timedlock(), and pthread_mutex_trylock() will return zero, otherwise an error number will be returned to indicate the error. ERRORS pthread_mutex_lock(), pthread_mutex_timedlock(), and pthread_mutex_trylock() will fail if: [EINVAL] The value specified by mutex is invalid. [EAGAIN] The mutex is of type PTHREAD_MUTEX_RECURSIVE and the maximum recursion count has been reached. In addition, pthread_mutex_lock() and pthread_mutex_timedlock() may return the following error: [EDEADLK] The mutex is of type PTHREAD_MUTEX_ERRORCHECK and is already locked by the calling thread. pthread_mutex_timedlock() may return the following error: [ETIMEDOUT] The mutex could not be locked and the specified time was reached. pthread_mutex_trylock() may return the following error: [EBUSY] The mutex could not be locked because it was already locked. SEE ALSO pthread_mutex_destroy(3), pthread_mutex_init(3), pthread_mutex_unlock(3), pthread_mutexattr_settype(3) STANDARDS pthread_mutex_lock(), pthread_mutex_timedlock(), and pthread_mutex_trylock() conform to IEEE Std 1003.1-2008 ("POSIX.1"). FreeBSD 14.1-RELEASE-p8 June 5, 2013 FreeBSD 14.1-RELEASE-p8

Navigation Options