Home > pthread mutex lock error > pthread_mutex_lock error numbers

Pthread_mutex_lock Error Numbers

Contents

- lock and unlock a mutex SYNOPSIS [THR] [Option Start] #include <pthread.h>

int pthread_mutex_lock(pthread_mutex_t *
mutex);
int pthread_mutex_trylock(pthread_mutex_t *
mutex);
int pthread_mutex_unlock(pthread_mutex_t *
mutex); [Option End] pthread_mutex_lock example DESCRIPTION The mutex object referenced by mutex shall be locked by calling pthread_mutex_lock(). If pthread_mutex_lock return value the mutex is already locked, the calling thread shall block until the mutex becomes available. This operation shall return with man pthread_mutex_lock the mutex object referenced by mutex in the locked state with the calling thread as its owner. [XSI] If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection shall not be provided. Attempting to relock the

Pthread_mutex_trylock

mutex causes deadlock. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, undefined behavior results. If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking shall be provided. If a thread attempts to relock a mutex that it has already locked, an error shall be returned. If a thread attempts to unlock a mutex that it has not locked pthread_mutex_init or a mutex which is unlocked, an error shall be returned. If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex shall maintain the concept of a lock count. When a thread successfully acquires a mutex for the first time, the lock count shall be set to one. Every time a thread relocks this mutex, the lock count shall be incremented by one. Each time the thread unlocks the mutex, the lock count shall be decremented by one. When the lock count reaches zero, the mutex shall become available for other threads to acquire. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, an error shall be returned. If the mutex type is PTHREAD_MUTEX_DEFAULT, attempting to recursively lock the mutex results in undefined behavior. Attempting to unlock the mutex if it was not locked by the calling thread results in undefined behavior. Attempting to unlock the mutex if it is not locked results in undefined behavior. The pthread_mutex_trylock() function shall be equivalent to pthread_mutex_lock(), except that if the mutex object referenced by mutex is currently locked (by any thread, including the current thread), the call shall return immediately. If the mutex type is PTHR

the interface may not be implemented on Linux. Name pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock - lock and unlock a mutex Synopsis #include int pthread_mutex_lock(pthread_mutex_t *mutex); int pthread_mutex_trylock(pthread_mutex_t *mutex); int pthread_mutex_unlock(pthread_mutex_t pthread_mutex_initializer *mutex); Description The mutex object referenced by mutex shall be locked by

Pthread_mutex_unlock

calling pthread_mutex_lock(). If the mutex is already locked, the calling thread shall block until the mutex becomes available. This

Pthread_mutex_lock Error 22

operation shall return with the mutex object referenced by mutex in the locked state with the calling thread as its owner. If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection shall not be http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html provided. Attempting to relock the mutex causes deadlock. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, undefined behavior results. If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking shall be provided. If a thread attempts to relock a mutex that it has already locked, an error shall be returned. If a thread attempts https://linux.die.net/man/3/pthread_mutex_lock to unlock a mutex that it has not locked or a mutex which is unlocked, an error shall be returned. If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex shall maintain the concept of a lock count. When a thread successfully acquires a mutex for the first time, the lock count shall be set to one. Every time a thread relocks this mutex, the lock count shall be incremented by one. Each time the thread unlocks the mutex, the lock count shall be decremented by one. When the lock count reaches zero, the mutex shall become available for other threads to acquire. If a thread attempts to unlock a mutex that it has not locked or a mutex which is unlocked, an error shall be returned. If the mutex type is PTHREAD_MUTEX_DEFAULT, attempting to recursively lock the mutex results in undefined behavior. Attempting to unlock the mutex if it was not locked by the calling thread results in undefined behavior. Attempting to unlock the mutex if it is not locked results in undefined behavior. The pthread_mutex_trylock() function shall be equivalent to pthread_mutex_lock(), except that if the mutex object referenc

SyntaxNext: Unlocking a Mutex pthread_mutex_lock Return Values pthread_mutex_lock() returns zero after completing successfully. Any other return value indicates that an error occurred. When any of the following conditions occurs, the function fails and returns the corresponding value. EAGAIN Description: The mutex could not be acquired because the maximum number of recursive locks for mutex has been exceeded. EDEADLK Description: The current thread already owns the mutex. If the mutex was initialized with the PTHREAD_MUTEX_ROBUST_NProbustness attribute, pthread_mutex_lock() may return one of the following values: EOWNERDEAD Description: The last owner of this mutex terminated while holding the mutex. This mutex is now owned by the caller. The caller must attempt to make the state protected by the mutex consistent. If the caller is able to make the state consistent, call pthread_mutex_consistent_np() for the mutex and unlock the mutex. Subsequent calls to pthread_mutex_lock() behave normally. If the caller is unable to make the state consistent, do not call pthread_mutex_init() for the mutex. Unlock the mutex instead. Subsequent calls to pthread_mutex_lock() fail to acquire the mutex and return an ENOTRECOVERABLE error code. If the owner that acquired the lock with EOWNERDEAD terminates while holding the mutex, the next owner acquires the lock with EOWNERDEAD. ENOTRECOVERABLE Description: The mutex you are trying to acquire was protecting state left irrecoverable by the mutex's previous owner. The mutex has not been acquired. This irrecoverable condition can occur when: The lock was previously acquired with EOWNERDEAD The owner was unable to cleanup the state The owner unlocked the mutex without making the mutex state consistent ENOMEM Description: The limit on the number of simultaneously held mutexes has been exceeded. Previous: pthread_mutex_lock SyntaxNext: Unlocking a Mutex © 2010, Oracle Corporation and/or its affiliates

 

Related content

pthread_mutex_lock error handling

Pthread mutex lock Error Handling table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex lock Return Value a li li a href What Is Pthread mutex lock a li li a href Man Pthread mutex lock a li ul td tr tbody table p pthread mutex lock pthread mutex t i mutex i int pthread mutex trylock pthread mutex t i mutex i int pthread mutex unlock pthread mutex t i mutex i DESCRIPTION The mutex object referenced by mutex is locked by calling pthread mutex lock If the mutex is already

pthread_mutex_lock error 35

Pthread mutex lock Error table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex lock Return Value a li li a href Pthread mutex init a li li a href Pthread mutex unlock a li ul td tr tbody table p p p p p p p p

pthread_mutex_lock error codes

Pthread mutex lock Error Codes table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex lock Return Value a li li a href Pthread mutex trylock a li li a href Pthread mutex init a li li a href Pthread mutex initializer a li ul td tr tbody table p pthread mutex lock pthread mutex t i mutex i int pthread mutex trylock pthread mutex t i mutex i int pthread mutex unlock pthread mutex t i mutex i DESCRIPTION The mutex object referenced by mutex is locked by calling pthread mutex lock

pthread_mutex_lock error code 22

Pthread mutex lock Error Code table id toc tbody tr td div id toctitle Contents div ul li a href Mutex Lock Failed a li li a href Pthread Mutex Example a li li a href Pthread mutex initializer a li ul td tr tbody table p here for a quick overview of the site Help Center Detailed answers to any questions relatedl you might have Meta Discuss the workings and policies pthread mutex lock mutex failed with error of this site About Us Learn more about Stack Overflow the company Business p h id Mutex Lock Failed p Learn

pthread_mutex_lock error checking

Pthread mutex lock Error Checking table id toc tbody tr td div id toctitle Contents div ul li a href Pthread mutex init a li li a href Pthread mutex initializer a li ul td tr tbody table p pthread mutex lock pthread mutex t i mutex i int pthread mutex trylock pthread mutex t i mutex i int pthread mutex unlock pthread mutex t i mutex i DESCRIPTION The mutex object referenced by mutex is locked by calling pthread mutex lock If the mutex is already locked the calling thread blocks until the mutex becomes relatedl available This operation