1PTHREAD_MUTEXATTR_GETPSHAREDP(O3SPI)X Programmer's MPaTnHuRaElAD_MUTEXATTR_GETPSHARED(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared — get and
13 set the process-shared attribute
14
16 #include <pthread.h>
17
18 int pthread_mutexattr_getpshared(const pthread_mutexattr_t
19 *restrict attr, int *restrict pshared);
20 int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
21 int pshared);
22
24 The pthread_mutexattr_getpshared() function shall obtain the value of
25 the process-shared attribute from the attributes object referenced by
26 attr.
27
28 The pthread_mutexattr_setpshared() function shall set the process-
29 shared attribute in an initialized attributes object referenced by
30 attr.
31
32 The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit
33 a mutex to be operated upon by any thread that has access to the memory
34 where the mutex is allocated, even if the mutex is allocated in memory
35 that is shared by multiple processes. See Section 2.9.9, Synchroniza‐
36 tion Object Copies and Alternative Mappings for further requirements.
37 The default value of the attribute shall be PTHREAD_PROCESS_PRIVATE.
38
39 The behavior is undefined if the value specified by the attr argument
40 to pthread_mutexattr_getpshared() or pthread_mutexattr_setpshared()
41 does not refer to an initialized mutex attributes object.
42
44 Upon successful completion, pthread_mutexattr_setpshared() shall return
45 zero; otherwise, an error number shall be returned to indicate the
46 error.
47
48 Upon successful completion, pthread_mutexattr_getpshared() shall return
49 zero and store the value of the process-shared attribute of attr into
50 the object referenced by the pshared parameter. Otherwise, an error
51 number shall be returned to indicate the error.
52
54 The pthread_mutexattr_setpshared() function may fail if:
55
56 EINVAL The new value specified for the attribute is outside the range
57 of legal values for that attribute.
58
59 These functions shall not return an error code of [EINTR].
60
61 The following sections are informative.
62
64 None.
65
67 None.
68
70 If an implementation detects that the value specified by the attr argu‐
71 ment to pthread_mutexattr_getpshared() or pthread_mutexattr_setp‐
72 shared() does not refer to an initialized mutex attributes object, it
73 is recommended that the function should fail and report an [EINVAL]
74 error.
75
77 None.
78
80 pthread_cond_destroy(), pthread_create(), pthread_mutex_destroy(),
81 pthread_mutexattr_destroy()
82
83 The Base Definitions volume of POSIX.1‐2017, <pthread.h>
84
86 Portions of this text are reprinted and reproduced in electronic form
87 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
88 table Operating System Interface (POSIX), The Open Group Base Specifi‐
89 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
90 Electrical and Electronics Engineers, Inc and The Open Group. In the
91 event of any discrepancy between this version and the original IEEE and
92 The Open Group Standard, the original IEEE and The Open Group Standard
93 is the referee document. The original Standard can be obtained online
94 at http://www.opengroup.org/unix/online.html .
95
96 Any typographical or formatting errors that appear in this page are
97 most likely to have been introduced during the conversion of the source
98 files to man page format. To report such errors, see https://www.ker‐
99 nel.org/doc/man-pages/reporting_bugs.html .
100
101
102
103IEEE/The Open Group 2017 PTHREAD_MUTEXATTR_GETPSHARED(3P)