]>
Commit | Line | Data |
---|---|---|
b967efeb MK |
1 | .\" Copyright (c) 2017, Michael Kerrisk <mtk.manpages@gmail.com> |
2 | .\" | |
5fbde956 | 3 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
b967efeb | 4 | .\" |
45186a5d | 5 | .TH PTHREAD_MUTEXATTR_GETPSHARED 3 2021-03-22 "Linux man-pages (unreleased)" |
b967efeb MK |
6 | .SH NAME |
7 | pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set | |
8 | process-shared mutex attribute | |
fba5d1c4 AC |
9 | .SH LIBRARY |
10 | POSIX threads library | |
8fc3b2cf | 11 | .RI ( libpthread ", " \-lpthread ) |
b967efeb MK |
12 | .SH SYNOPSIS |
13 | .nf | |
14 | .B #include <pthread.h> | |
15 | .PP | |
1ae6b2c7 | 16 | .B int pthread_mutexattr_getpshared( |
48ee34e7 MK |
17 | .BI " const pthread_mutexattr_t *restrict " attr , |
18 | .BI " int *restrict " pshared ); | |
b967efeb | 19 | .BI "int pthread_mutexattr_setpshared(pthread_mutexattr_t *" attr , |
48ee34e7 | 20 | .BI " int " pshared ); |
b967efeb | 21 | .fi |
b967efeb MK |
22 | .SH DESCRIPTION |
23 | These functions get and set the process-shared attribute | |
24 | in a mutex attributes object. | |
25 | This attribute must be appropriately set to ensure correct, | |
26 | efficient operation of a mutex created using this attributes object. | |
27 | .PP | |
28 | The process-shared attribute can have one of the following values: | |
29 | .TP | |
30 | .B PTHREAD_PROCESS_PRIVATE | |
31 | Mutexes created with this attributes object are to be shared | |
32 | only among threads in the same process that initialized the mutex. | |
33 | This is the default value for the process-shared mutex attribute. | |
34 | .TP | |
35 | .B PTHREAD_PROCESS_SHARED | |
36 | Mutexes created with this attributes object can be shared between | |
37 | any threads that have access to the memory containing the object, | |
38 | including threads in different processes. | |
39 | .PP | |
40 | .BR pthread_mutexattr_getpshared () | |
41 | places the value of the process-shared attribute of | |
42 | the mutex attributes object referred to by | |
1ae6b2c7 | 43 | .I attr |
b967efeb MK |
44 | in the location pointed to by |
45 | .IR pshared . | |
46 | .PP | |
47 | .BR pthread_mutexattr_setpshared () | |
48 | sets the value of the process-shared attribute of | |
49 | the mutex attributes object referred to by | |
1ae6b2c7 | 50 | .I attr |
b967efeb MK |
51 | to the value specified in |
52 | .BR pshared . | |
53 | .PP | |
54 | If | |
55 | .I attr | |
56 | does not refer to an initialized mutex attributes object, | |
57 | the behavior is undefined. | |
58 | .SH RETURN VALUE | |
59 | On success, these functions return 0. | |
60 | On error, they return a positive error number. | |
61 | .SH ERRORS | |
62 | .BR pthread_mutexattr_setpshared () | |
63 | can fail with the following errors: | |
64 | .TP | |
65 | .B EINVAL | |
66 | The value specified in | |
67 | .I pshared | |
68 | is invalid. | |
69 | .TP | |
70 | .B ENOTSUP | |
71 | .I pshared is | |
1ae6b2c7 | 72 | .B PTHREAD_PROCESS_SHARED |
b967efeb | 73 | but the implementation does not support process-shared mutexes. |
3113c7f3 | 74 | .SH STANDARDS |
b967efeb MK |
75 | POSIX.1-2001, POSIX.1-2008. |
76 | .SH SEE ALSO | |
77 | .ad l | |
78 | .nh | |
79 | .BR pthread_mutexattr_init (3), | |
80 | .BR pthreads (7) |