1PTHREAD_MUTEXATTR_GETPSHAREDP(OPS)IX Programmer's MaPnTuHaRlEAD_MUTEXATTR_GETPSHARED(P)
2
3
4
6 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared - get and
7 set the process-shared attribute
8
10 #include <pthread.h>
11
12 int pthread_mutexattr_getpshared(const pthread_mutexattr_t *
13 restrict attr, int *restrict pshared);
14 int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
15 int pshared);
16
17
19 The pthread_mutexattr_getpshared() function shall obtain the value of
20 the process-shared attribute from the attributes object referenced by
21 attr. The pthread_mutexattr_setpshared() function shall set the
22 process-shared attribute in an initialized attributes object referenced
23 by attr.
24
25 The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit
26 a mutex to be operated upon by any thread that has access to the memory
27 where the mutex is allocated, even if the mutex is allocated in memory
28 that is shared by multiple processes. If the process-shared attribute
29 is PTHREAD_PROCESS_PRIVATE, the mutex shall only be operated upon by
30 threads created within the same process as the thread that initialized
31 the mutex; if threads of differing processes attempt to operate on such
32 a mutex, the behavior is undefined. The default value of the attribute
33 shall be PTHREAD_PROCESS_PRIVATE.
34
36 Upon successful completion, pthread_mutexattr_setpshared() shall return
37 zero; otherwise, an error number shall be returned to indicate the
38 error.
39
40 Upon successful completion, pthread_mutexattr_getpshared() shall return
41 zero and store the value of the process-shared attribute of attr into
42 the object referenced by the pshared parameter. Otherwise, an error
43 number shall be returned to indicate the error.
44
46 The pthread_mutexattr_getpshared() and pthread_mutexattr_setpshared()
47 functions may fail if:
48
49 EINVAL The value specified by attr is invalid.
50
51
52 The pthread_mutexattr_setpshared() function may fail if:
53
54 EINVAL The new value specified for the attribute is outside the range
55 of legal values for that attribute.
56
57
58 These functions shall not return an error code of [EINTR].
59
60 The following sections are informative.
61
63 None.
64
66 None.
67
69 None.
70
72 None.
73
75 pthread_cond_destroy() , pthread_create() , pthread_mutex_destroy() ,
76 pthread_mutexattr_destroy() , the Base Definitions volume of
77 IEEE Std 1003.1-2001, <pthread.h>
78
80 Portions of this text are reprinted and reproduced in electronic form
81 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
82 -- Portable Operating System Interface (POSIX), The Open Group Base
83 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
84 Electrical and Electronics Engineers, Inc and The Open Group. In the
85 event of any discrepancy between this version and the original IEEE and
86 The Open Group Standard, the original IEEE and The Open Group Standard
87 is the referee document. The original Standard can be obtained online
88 at http://www.opengroup.org/unix/online.html .
89
90
91
92IEEE/The Open Group 2003 PTHREAD_MUTEXATTR_GETPSHARED(P)