pthread_mutexattr_init Subroutine



Purpose

Creates a mutex attributes object and initializes it with default
values.

Library

Threads Library (libpthreads.a)

Syntax

#include 

int pthread_mutexattr_init (attr)
pthread_mutexattr_t *attr;

Description

The pthread_mutexattr_init subroutine creates a new mutex attributes
object attr. The new mutex attributes object is initialized with the
following default values:


------------------------------------------------------------------------------------------------------------------
|Initialized if _POSIX_THREAD_PRIO_INHERIT is defined            
                                               |
|------------------------------------------------------------|---------------------------------------------------|
|Attribute                                                   |Default
value                                      |
|------------------------------------------------------------|---------------------------------------------------|
|Protocol                                                    |NO_PRIO_INHERIT
                                   |
|                                                            |the
default ensures compatibility with             |
|                                                            |implementations
that do not support this POSIX     |
|                                                            |option.
                                           |
------------------------------------------------------------------------------------------------------------------



------------------------------------------------------------------------------------------------------------------
|Initialized if _POSIX_THREAD_PRIO_PROTECT is defined            
                                               |
|------------------------------------------------------------|---------------------------------------------------|
|Attribute                                                   |Default
value                                      |
|------------------------------------------------------------|---------------------------------------------------|
|Prioceiling                                                 |1 (default
thread priority)                        |
------------------------------------------------------------------------------------------------------------------



------------------------------------------------------------------------------------------------------------------
|Initialized if _POSIX_THREAD_PROCESS_SHARED is defined          
                                               |
|------------------------------------------------------------|---------------------------------------------------|
|Attribute                                                   |Default
value                                      |
|------------------------------------------------------------|---------------------------------------------------|
|Process-shared                                              |PTHREAD_PROCESS_PRIVATE
                           |
|                                                            |the
default ensures compatibility with             |
|                                                            |implementations
that do not support this POSIX     |
|                                                            |option.
                                           |
------------------------------------------------------------------------------------------------------------------


Note:	The pthread.h header file must be the first included file of
each source file using the threads library.

Parameters

attr	Specifies the mutex attributes object to be created.

Return Values

Upon successful completion, the new mutex attributes object is filled
with default values and returned via the attr parameter, and 0 is
returned. Otherwise, an error code is returned.

Error Codes

The pthread_mutexattr_init subroutine is unsuccessful if the following
is true:

EINVAL	The attr parameter is not valid.

ENOMEM	There is not sufficient memory to create the mutex attributes
object.

Implementation Specifics

This subroutine is part of the Base Operating System (BOS) Runtime.

The priority inheritance, priority protection, and process sharing
POSIX options are not implemented in the current version of AIX.

Related Information

The pthread_mutexattr_setprioceiling subroutine, pthread_mutexattr_setprotocol
subroutine, pthread_mutexattr_setpshared subroutine, pthread_mutex_init
subroutine, pthread_mutexattr_destroy subroutine.

Using Mutexes.

Threads Library Options and Threads Library Quick Reference.