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

pthread_mutexattr_init(2) OSS System Calls Reference Manual
NAME
pthread_mutexattr_init
- Initializes 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>
int pthread_mutexattr_init(
pthread_mutexattr_t *
attr);
PARAMETERS
attr species the mutex attributes object to be initialized.
If the value specied is pthread_mutexattr_default
, then the default attribute
is:
MUTEX_FAST_NP
species the mutex type (normal). A normal mutex is locked
exactly once by a thread. If a thread tries to lock the mutex
again without rst unlocking it, the thread waits for itself to
release the lock and thereby deadlocks.
DESCRIPTION
This function initializes the mutex attributes object specied by the attr parameter with a set of
default attribute values. A mutex attributes object is used to specify the attributes of mutexes
when they are created. The mutex attributes object created by this function is used only in calls
to the pthread_mutex_init() function.
When a mutex attributes object is used to create a mutex, the values of the individual attributes
determine the characteristics of the new mutex. Thus, mutex attributes objects act as additional
arguments to creation of mutexes. Changing individual attributes in a mutex attributes object
does not affect any mutexes that were previously created using that mutex attributes object.
You can use the same mutex attributes object in successive calls to pthread_mutex_init() from
any thread. If multiple threads can change attributes in a shared mutex attributes object, your
program must use a mutex to protect the integrity of that mutex attributes object.
NOTES
The pthread_mutexattr_init( ) and pthread_mutexattr_destroy() functions are provided for
future expansion of the threads interface and to conform with the POSIX.1c standard. These
functions are not currently useful, because the functions to set and get the process shared attri-
bute are not supported by this implementation.
RETURN VALUES
If an error condition occurs, this function returns an integer value indicating the type of error.
Possible return values are:
0 Successful completion.
[ENOMEM] Not enough memory exists to initialize the mutex attributes object.
RELATED INFORMATION
Functions: pthread_mutex_init(2), pthread_mutexattr_destroy(2).
584 Hewlett-Packard Company 527186-003