]>
Commit | Line | Data |
---|---|---|
b967efeb MK |
1 | .\" Copyright (c) 2017, Michael Kerrisk <mtk.manpages@gmail.com> |
2 | .\" | |
3 | .\" %%%LICENSE_START(VERBATIM) | |
4 | .\" Permission is granted to make and distribute verbatim copies of this | |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
12 | .\" | |
13 | .\" Since the Linux kernel and libraries are constantly changing, this | |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
23 | .\" %%%LICENSE_END | |
24 | .\" | |
25 | .TH PTHREAD_MUTEXATTR_GETPSHARED 3 2017-09-13 "Linux" "Linux Programmer's Manual" | |
26 | .SH NAME | |
27 | pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set | |
28 | process-shared mutex attribute | |
29 | .SH SYNOPSIS | |
30 | .nf | |
31 | .B #include <pthread.h> | |
32 | .PP | |
33 | .BI "int pthread_mutexattr_getpshared(const pthread_mutexattr_t *" attr , | |
34 | .BI " int *" pshared ); | |
35 | .BI "int pthread_mutexattr_setpshared(pthread_mutexattr_t *" attr , | |
36 | .BI " int " pshared ); | |
37 | .fi | |
38 | .PP | |
39 | Compile and link with \fI\-pthread\fP. | |
40 | .SH DESCRIPTION | |
41 | These functions get and set the process-shared attribute | |
42 | in a mutex attributes object. | |
43 | This attribute must be appropriately set to ensure correct, | |
44 | efficient operation of a mutex created using this attributes object. | |
45 | .PP | |
46 | The process-shared attribute can have one of the following values: | |
47 | .TP | |
48 | .B PTHREAD_PROCESS_PRIVATE | |
49 | Mutexes created with this attributes object are to be shared | |
50 | only among threads in the same process that initialized the mutex. | |
51 | This is the default value for the process-shared mutex attribute. | |
52 | .TP | |
53 | .B PTHREAD_PROCESS_SHARED | |
54 | Mutexes created with this attributes object can be shared between | |
55 | any threads that have access to the memory containing the object, | |
56 | including threads in different processes. | |
57 | .PP | |
58 | .BR pthread_mutexattr_getpshared () | |
59 | places the value of the process-shared attribute of | |
60 | the mutex attributes object referred to by | |
61 | .IR attr | |
62 | in the location pointed to by | |
63 | .IR pshared . | |
64 | .PP | |
65 | .BR pthread_mutexattr_setpshared () | |
66 | sets the value of the process-shared attribute of | |
67 | the mutex attributes object referred to by | |
68 | .IR attr | |
69 | to the value specified in | |
70 | .BR pshared . | |
71 | .PP | |
72 | If | |
73 | .I attr | |
74 | does not refer to an initialized mutex attributes object, | |
75 | the behavior is undefined. | |
76 | .SH RETURN VALUE | |
77 | On success, these functions return 0. | |
78 | On error, they return a positive error number. | |
79 | .SH ERRORS | |
80 | .BR pthread_mutexattr_setpshared () | |
81 | can fail with the following errors: | |
82 | .TP | |
83 | .B EINVAL | |
84 | The value specified in | |
85 | .I pshared | |
86 | is invalid. | |
87 | .TP | |
88 | .B ENOTSUP | |
89 | .I pshared is | |
90 | .BR PTHREAD_PROCESS_SHARED | |
91 | but the implementation does not support process-shared mutexes. | |
92 | .SH CONFORMING TO | |
93 | POSIX.1-2001, POSIX.1-2008. | |
94 | .SH SEE ALSO | |
95 | .ad l | |
96 | .nh | |
97 | .BR pthread_mutexattr_init (3), | |
98 | .BR pthreads (7) |