Specifies the mutex type attribute that is used when a mutex is
created.
Syntax
pthread_mutexattr_settype_np(
attr,
type );
Argument Data Type Access
attr opaque pthread_ write
mutexattr_t
type integer read
C Binding
#include
int
pthread_mutexattr_settype_np (
pthread_mutexattr_t *attr,
int type);
Arguments
- attr
- Mutex attributes object whose mutex type attribute is modified.
- type
- New value for the mutex type attribute. The type
argument specifies the type of mutex that is created. Valid values
are:
- PTHREAD_MUTEX_NORMAL_NP (default)
- PTHREAD_MUTEX_RECURSIVE_NP
- PTHREAD_MUTEX_ERRORCHECK_NP
Description
This routine sets the mutex type attribute that is used to
determine which type of mutex is created on a call to pthread_
mutex_init. See Section 2.2.4.1
for information on the types of mutexes.
Return Values
If an error condition occurs, this routine returns an integer value
indicating the type of error. Possible return values are as follows:
Return Description
0 Successful completion.
[EINVAL] The value specified by attr or
type is invalid.
[ESRCH] The value specified by attr does not refer
to an existing mutex attributes object.
Associated Routines
pthread_mutexattr_init
pthread_mutexattr_gettype_np
pthread_mutex_init