PTHREAD_MUTEXATTR_GETTYPE(3C) | Standard C Library Functions | PTHREAD_MUTEXATTR_GETTYPE(3C) |
pthread_mutexattr_gettype, pthread_mutexattr_settype - get or set mutex type
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> int pthread_mutexattr_gettype(pthread_mutexattr_t *restrict attr,
int *restrict type);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
The pthread_mutexattr_gettype() and pthread_mutexattr_settype() functions respectively get and set the mutex type attribute. This attribute is set in the type parameter to these functions. The default value of the type attribute is PTHREAD_MUTEX_DEFAULT.
The type of mutex is contained in the type attribute of the mutex attributes. Valid mutex types include:
PTHREAD_MUTEX_NORMAL
PTHREAD_MUTEX_ERRORCHECK
PTHREAD_MUTEX_RECURSIVE
PTHREAD_MUTEX_DEFAULT
Upon successful completion, the pthread_mutexattr_settype() function returns 0. Otherwise, an error number is returned to indicate the error.
Upon successful completion, the pthread_mutexattr_gettype() function returns 0 and stores the value of the type attribute of attr in the object referenced by the type parameter. Otherwise an error number is returned to indicate the error.
The pthread_mutexattr_gettype() and pthread_mutexattr_settype() functions will fail if:
EINVAL
The pthread_mutexattr_gettype() and pthread_mutexattr_settype() functions may fail if:
EINVAL
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Standard |
MT-Level | MT-Safe |
pthread_cond_timedwait(3C), pthread_cond_wait(3C), attributes(7), standards(7)
Application should not use a PTHREAD_MUTEX_RECURSIVE mutex with condition variables because the implicit unlock performed for pthread_cond_wait() or pthread_cond_timedwait() will not actually release the mutex (if it had been locked multiple times). If this occurs, no other thread can satisfy the condition of the predicate.
March 23, 2005 | OmniOS |