Open System Services System Calls Reference Manual (G06.25+, H06.03+)

pthread_mutexattr_setkind_np(2) OSS System Calls Reference Manual
NAME
pthread_mutexattr_setkind_np
- Sets the mutex type attribute of a mutex attributes object
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
extern int pthread_mutexattr_setkind_np(
pthread_mutexattr_t *
attr,
int kind );
PARAMETERS
attr species the mutex attributes object whose mutex type attribute is to be
modied.
kind species the new value for the mutex type attribute. Valid values are:
MUTEX_FAST_NP
This is the default value. Creates a default mutex.
MUTEX_NONRECURSIVE_NP
Creates a normal mutex.
MUTEX_RECURSIVE_NP
Creates a recursive mutex.
DESCRIPTION
The pthread_mutexattr_setkind_np() function sets the mutex type attribute of the mutex attri-
butes object specied by the attr parameter.
A fast (default) mutex is locked and unlocked in the fastest manner possible. A fast mutex can
be locked (obtained) only once. All subsequent calls to the pthread_mutex_lock( ) function by
the owning thread return [EDEADLK]. Subsequent calls by another thread block.
A normal (nonrecursive) mutex is locked only once by a thread, like a fast (default) mutex. If the
thread tries to lock the mutex again without rst unlocking it, the thread receives an error. Also,
if someone other than the owner tries to unlock a nonrecursive mutex, an error is returned.
A recursive mutex can be locked more than once by the same thread without returning an error.
That is, a single thread can make consecutive calls to pthread_mutex_lock( ) without blocking.
The thread must then call the pthread_mutex_unlock() function the same number of times as it
called pthread_mutex_lock( ) before another thread can lock the mutex.
Never use a recursive mutex with condition variables, because the implicit unlock performed for
a call to the pthread_cond_wait() or pthread_cond_timedwait() function might not actually
release the mutex. In that case, no other thread can satisfy the condition of the predicate.
RETURN VALUES
One of the following values can be returned:
0 Successful completion.
[EINVAL] The value specied by the attr parameter is invalid.
586 Hewlett-Packard Company 527186-003