pthread_mutexattr_settype()

Set a mutex type

Synopsis:

#include <pthread.h>

int pthread_mutexattr_settype( 
                      pthread_mutexattr_t * attr, 
                      int type );

Arguments:

attr
A pointer to the pthread_mutexattr_t object that you want to set the attribute in.
type
The new type; one of:

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_mutexattr_settype() function sets the mutex type in the mutex attribute object attr to the value given by type.

Returns:

EOK
Success.
EINVAL
The value specified by attr or type is invalid.

Classification:

POSIX 1003.1 XSI

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

An application shouldn't use a PTHREAD_MUTEX_RECURSIVE mutex with condition variables because the implicit unlock performed for a pthread_cond_wait() or pthread_cond_timedwait() may not actually release the mutex (if it's been locked multiple times). If this happens, no other thread can satisfy the condition of the predicate.

See also:

pthread_cond_timedwait(), pthread_cond_wait(), pthread_mutexattr_gettype()