Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.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
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library:
/G/system/zdllnnn/yputdll
H-series and J-series OSS processes that use the Standard POSIX Threads library:
/G/system/zdllnnn/zsptdll
SYNOPSIS
#include <pthread.h> | #include <spthread.h>
/* pthread.h is required to use POSIX User Thread Model library */
/* spthread.h is required to use Standard POSIX Threads library */
int pthread_mutexattr_init(
pthread_mutexattr_t *attr);
PARAMETERS
attr Specifies the mutex attributes object to be initialized.
For the Standard POSIX Threads library, if the value specified is
pthread_mutexattr_default, then the default attribute is:
MUTEX_FAST_NP
specifies the mutex type (normal). A normal mutex is locked
exactly once by a thread. If a thread tries to lock the mutex
again without first unlocking it, the thread waits for itself to
release the lock and thereby deadlocks.
DESCRIPTION
This function initializes the mutex attributes object specified 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.
On systems running H06.21 or later H-series RVUs or J06.10 or later J-series RVUs, you can use
either the POSIX User Thread Model library or the Standard POSIX Threads library for threaded
applications.
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks:
Include the pthread.h header file in the application.
5146 Hewlett-Packard Company 527186-023