]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/pthread_mutexattr_getpshared.3
Revert "src.mk, All pages: Move man* to man/"
[thirdparty/man-pages.git] / man3 / pthread_mutexattr_getpshared.3
1 .\" Copyright (c) 2017, Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH PTHREAD_MUTEXATTR_GETPSHARED 3 2021-03-22 "Linux man-pages (unreleased)"
6 .SH NAME
7 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set
8 process-shared mutex attribute
9 .SH LIBRARY
10 POSIX threads library
11 .RI ( libpthread ", " \-lpthread )
12 .SH SYNOPSIS
13 .nf
14 .B #include <pthread.h>
15 .PP
16 .B int pthread_mutexattr_getpshared(
17 .BI " const pthread_mutexattr_t *restrict " attr ,
18 .BI " int *restrict " pshared );
19 .BI "int pthread_mutexattr_setpshared(pthread_mutexattr_t *" attr ,
20 .BI " int " pshared );
21 .fi
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
43 .I attr
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
50 .I attr
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
72 .B PTHREAD_PROCESS_SHARED
73 but the implementation does not support process-shared mutexes.
74 .SH STANDARDS
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)