int pthread_mutex_lock(pthread_mutex_t *mutex);
If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not provided. Attempting to relock the mutex causes deadlock.
If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking is provided. If a thread attempts to relock a mutex that it has already locked, an error is returned.
If the mutex type is PTHREAD_MUTEX_RECURSIVE, the mutex maintains the concept of a lock count. When a thread successfully acquires a mutex for the first time, the lock count is set to one. Every time a thread relocks this mutex, the lock count is incremented by one. The mutex must be unlocked as many time as it was locked for the mutex to be released.
If the mutex type is PTHREAD_MUTEX_DEFAULT, attempting to recursively lock the mutex results in undefined behavior.
mutex is not an initialized mutex.
mutex is an invalid pointer.
The mutex type is PTHREAD_MUTEX_ERRORCHECK and an attempt was made to relock the mutex.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
pthread_mutex_init(), pthread_mutex_trylock(), pthread_mutex_unlock(), pthread_mutexattr_settype()
PTC MKS Toolkit 10.3 Documentation Build 39.