|PTHREAD_MUTEXATTR_GETPSHARED(3)||Linux Programmer's Manual||PTHREAD_MUTEXATTR_GETPSHARED(3)|
int pthread_mutexattr_getpshared( const pthread_mutexattr_t *restrict attr, int *restrict pshared); int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);
Compile and link with -pthread.
The process-shared attribute can have one of the following values:
- Mutexes created with this attributes object are to be shared only among threads in the same process that initialized the mutex. This is the default value for the process-shared mutex attribute.
- Mutexes created with this attributes object can be shared between any threads that have access to the memory containing the object, including threads in different processes.
pthread_mutexattr_getpshared() places the value of the process-shared attribute of the mutex attributes object referred to by attr in the location pointed to by pshared.
pthread_mutexattr_setpshared() sets the value of the process-shared attribute of the mutex attributes object referred to by attr to the value specified in pshared.
If attr does not refer to an initialized mutex attributes object, the behavior is undefined.
- The value specified in pshared is invalid.
- pshared is PTHREAD_PROCESS_SHARED but the implementation does not support process-shared mutexes.