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
23
25 The pthread_mutexattr_getpshared() function shall obtain the value of
26 the process-shared attribute from the attributes object referenced by
27 attr. The pthread_mutexattr_setpshared() function shall set the
28 process-shared attribute in an initialized attributes object referenced
29 by attr.
30
31 The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit
32 a mutex to be operated upon by any thread that has access to the memory
33 where the mutex is allocated, even if the mutex is allocated in memory
34 that is shared by multiple processes. If the process-shared attribute
35 is PTHREAD_PROCESS_PRIVATE, the mutex shall only be operated upon by
36 threads created within the same process as the thread that initialized
37 the mutex; if threads of differing processes attempt to operate on such
38 a mutex, the behavior is undefined. The default value of the attribute
39 shall be PTHREAD_PROCESS_PRIVATE.
40
42 Upon successful completion, pthread_mutexattr_setpshared() shall return
43 zero; otherwise, an error number shall be returned to indicate the
44 error.
45
46 Upon successful completion, pthread_mutexattr_getpshared() shall return
47 zero and store the value of the process-shared attribute of attr into
48 the object referenced by the pshared parameter. Otherwise, an error
49 number shall be returned to indicate the error.
50
52 The pthread_mutexattr_getpshared() and pthread_mutexattr_setpshared()
53 functions may fail if:
54
55 EINVAL The value specified by attr is invalid.
56
57
58 The pthread_mutexattr_setpshared() function may fail if:
59
60 EINVAL The new value specified for the attribute is outside the range
61 of legal values for that attribute.
62
63
64 These functions shall not return an error code of [EINTR].
65
66 The following sections are informative.
67
69 None.
70
72 None.
73
75 None.
76
78 None.
79
81 pthread_cond_destroy(), pthread_create(), pthread_mutex_destroy(),
82 pthread_mutexattr_destroy(), the Base Definitions volume of
83 IEEE Std 1003.1-2001, <pthread.h>
84
86 Portions of this text are reprinted and reproduced in electronic form
87 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
88 -- Portable Operating System Interface (POSIX), The Open Group Base
89 Specifications Issue 6, Copyright (C) 2001-2003 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
97
98IEEE/The Open Group 2003 PTHREAD_MUTEXATTR_GETPSHARED(3P)