pthread_mutexattr_init()

Initialize a mutex attribute object

Synopsis:

#include <pthread.h>

int pthread_mutexattr_init( pthread_mutexattr_t* attr );

Since:

BlackBerry 10.0.0

Arguments:

attr
A pointer to the pthread_mutexattr_t object that you want to initialize.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_mutexattr_init() function initializes the attributes in the mutex attribute object attr to their default values. After initializing a mutex attribute object, you can use it to initialize one or more mutexes by calling pthread_mutex_init().

The mutex attributes and their default values are:

__protocol
PTHREAD_PRIO_INHERIT—when a thread is blocking higher-priority threads by locking one or more mutexes with this attribute, the thread's priority is raised to that of the highest priority thread waiting on the PTHREAD_PRIO_INHERIT mutex.
__recursive
PTHREAD_RECURSIVE_DISABLE—threads can't recursively lock a mutex; any thread that tries to lock an already locked mutex becomes blocked.

After calling this function, you can use the pthread_mutexattr_* family of functions to make any changes to the attributes:

Returns:

EOK
Success.
ENOMEM
Insufficient memory to initialize mutex attribute object attr.

Classification:

POSIX 1003.1 THR

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus