Standards / Extensions | C or C++ | Dependencies |
---|---|---|
z/OS UNIX |
both | POSIX(ON) |
#define _OPEN_THREADS
#include <pthread.h>
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);
#define _UNIX03_THREADS
#include <pthread.h>
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);
The pthread_mutexattr_setpshared() function sets the attribute pshared for the mutex attribute object attr.
A mutex attribute object allows you to manage the characteristics of mutexes in your application. It defines the set of values to be used for a mutex during its creation. By establishing a mutex attribute object, you can create many mutexes with the same set of characteristics, without needing to define the characteristics for each and every mutex. By using attr with the pthread_mutexattr_setpshared() function you can define its process-shared value for a mutex.
If successful, pthread_mutexattr_setpshared() returns 0.
Special behavior for Single UNIX Specification, Version 3: If unsuccessful, pthread_mutexattr_setpshared() returns an error number to indicate the error.