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