pthread_mutexattr_init 2. Syntax 3. Param 4. Return Value 5. Remark 6. Issue

Initialize a pthread_mutexattr_t object.

2. Syntax

1
#include <pthread.h>
1
int pthread_mutexattr_init(pthread_mutexattr_t *attr);

3. Param

3.1 attr

A pointer that point to a object of pthread_mutexattr_t stuct; The object is a space that store mutex attributions.

The function shall initialize attr with the default value for all of the attributes defined by the implementation.

4. Return Value

Upon successful, return zero; otherwise, an error number shall be returned to indicate the error.

5. Remark

Results are undefined if pthread_mutexattr_init() is called specifying an already initialized attr attributes object.

A destroyed attr attributes object can be reinitialized using pthread_mutexattr_init(); the results of otherwise referencing the object after it has been destroyed are undefined.

After a mutex attributes object has been used to initialize one or more mutexes, any function affecting the attributes object (including destruction) shall not affect any previously initialized mutexes.

6. Issue