pthread_set_mutexattr_default_np()--Set Default Mutex Attributes Object Kind Attribute


  Syntax:
 #include <pthread.h>
 #include <sched.h>
 int pthread_set_mutexattr_default_np(int kind);  
  Service Program Name: QP0WPTHR

  Default Public Authority: *USE

  Threadsafe: Yes

  Signal Safe: Yes

The pthread_set_mutexattr_default_np() function sets the kind attribute in the default mutex attribute object. The default mutex attributes object is used when pthread_mutex_init() is called to specify a NULL pointer for the mutex attributes object parameter.

The kind set may be one of PTHREAD_MUTEX_NONRECURSIVE_NP or PTHREAD_MUTEX_RECURSIVE_NP.

The pthread_set_mutexattr_default_np() function does not affect any currently existing mutex attributes objects, nor does it affect the subsequent behavior of pthread_mutexattr_init() or the PTHREAD_MUTEX_INITIALIZER macro.

Calls to pthread_set_mutexattr_default_np() change how the run-time of the threads creates default mutexes for all code running in the current process. You can negatively affect other code in your process that uses pthread mutexes by using this function.

Use of this function is not recommended because it can affect the creation of mutexes that your application does not directly own.

Note: This function is not portable.


Authorities and Locks

None.


Parameters

kind
(Input) Variable containing the kind attribute

Return Value

0
pthread_set_mutexattr_default() was successful.
value
pthread_set_mutexattr_default() was not successful. value is set to indicate the error condition.

Error Conditions

If pthread_set_mutexattr_default() was not successful, the error condition returned usually indicates one of the following errors. Under some conditions, the value returned could indicate an error other than those listed here.

[EINVAL]

The value specified for the argument is not correct.


Related Information


API introduced: V4R3

[ Back to top | Pthread APIs | APIs by category ]