pthread_mutexattr_getpshared (3) - Linux Man Pages
pthread_mutexattr_getpshared, pthread_mutexattr_setpshared - get/set process-shared mutex attribute
#include <pthread.h> int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared); int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);
DESCRIPTIONThese functions get and set the process-shared attribute in a mutex attributes object. This attribute must be appropriately set to ensure correct, efficient operation of a mutex created using this attributes object.
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.
RETURN VALUEOn success, these functions return 0. On error, they return a positive error number.
ERRORSpthread_mutexattr_setpshared() can fail with the following errors:
- The value specified in pshared is invalid.
- pshared is PTHREAD_PROCESS_SHARED but the implementation does not support process-shared mutexes.
CONFORMING TOPOSIX.1-2001, POSIX.1-2008.
COLOPHONThis page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.