1PTHREAD_MUTEXATTR_GETPSHAREDL(i3n)ux Programmer's MaPnTuHaRlEAD_MUTEXATTR_GETPSHARED(3)
2
3
4
6 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared - get/set
7 process-shared mutex attribute
8
10 #include <pthread.h>
11
12 int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
13 int *pshared);
14 int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
15 int pshared);
16
17 Compile and link with -pthread.
18
20 These functions get and set the process-shared attribute in a mutex at‐
21 tributes object. This attribute must be appropriately set to ensure
22 correct, efficient operation of a mutex created using this attributes
23 object.
24
25 The process-shared attribute can have one of the following values:
26
27 PTHREAD_PROCESS_PRIVATE
28 Mutexes created with this attributes object are to be shared
29 only among threads in the same process that initialized the mu‐
30 tex. This is the default value for the process-shared mutex at‐
31 tribute.
32
33 PTHREAD_PROCESS_SHARED
34 Mutexes created with this attributes object can be shared be‐
35 tween any threads that have access to the memory containing the
36 object, including threads in different processes.
37
38 pthread_mutexattr_getpshared() places the value of the process-shared
39 attribute of the mutex attributes object referred to by attr in the lo‐
40 cation pointed to by pshared.
41
42 pthread_mutexattr_setpshared() sets the value of the process-shared at‐
43 tribute of the mutex attributes object referred to by attr to the value
44 specified in pshared.
45
46 If attr does not refer to an initialized mutex attributes object, the
47 behavior is undefined.
48
50 On success, these functions return 0. On error, they return a positive
51 error number.
52
54 pthread_mutexattr_setpshared() can fail with the following errors:
55
56 EINVAL The value specified in pshared is invalid.
57
58 ENOTSUP
59 pshared is PTHREAD_PROCESS_SHARED but the implementation does
60 not support process-shared mutexes.
61
63 POSIX.1-2001, POSIX.1-2008.
64
66 pthread_mutexattr_init(3), pthreads(7)
67
69 This page is part of release 5.10 of the Linux man-pages project. A
70 description of the project, information about reporting bugs, and the
71 latest version of this page, can be found at
72 https://www.kernel.org/doc/man-pages/.
73
74
75
76Linux 2017-09-13 PTHREAD_MUTEXATTR_GETPSHARED(3)