pthread_mutexattr_settype(3P)
pthread_mutexattr_settype, pthread_mutexattr_gettype - set/get a mutex attribute object's type
As shipped in IRIX 6.5.7. Unchanged since IRIX 6.5.
NAME pthread_mutexattr_settype, pthread_mutexattr_gettype - set/get a mutex attribute object's type C SYNOPSIS #include <pthread.h> int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type); DESCRIPTION These functions manipulate a mutex attribute object referenced by attr which has been previously created by pthread_mutexattr_init(). The function pthread_mutexattr_settype() defines the type of mutex. The type value may be one of PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE, or PTHREAD_MUTEX_DEFAULT. The function pthread_mutexattr_gettype() stores into the memory referenced by type the mutex type associated with the named mutex attribute object. The default type is PTHREAD_MUTEX_DEFAULT. A mutex with a type attribute of PTHREAD_MUTEX_DEFAULT or PTHREAD_MUTEX_NORMAL works as a simple mutual exclusion lock with no error checking. A thread attempting to relock a mutex of this type will deadlock. A mutex with a type attribute of PTHREAD_MUTEX_ERRORCHECK is a simple mutual exclusion lock with error checking. A thread attempting to relock a mutex of this type will return an error. A thread attempting to unlock a mutex that another thread has locked will return an error. A thread attempting to unlock a mutex that has not been locked will return an error. A mutex with a type attribute of PTHREAD_MUTEX_RECURSIVE is a simple mutual exclusion lock with error checking that also allows a single thread to recursively lock the mutex. In this case there must be a matching number of unlocks by the thread before the mutex can be released. A thread attempting to unlock a mutex that another thread has locked will return an error. A thread attempting to unlock a mutex that has not been locked will return an error. DIAGNOSTICS The mutex attribute type functions return zero on success; otherwise, an error number is returned: [EINVAL] The value specified by type is invalid. SEE ALSO pthread_mutex_lock(3P), pthread_mutexattr_init(3P).