]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_mutexattr_getpshared.3
execve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, posix_memalign...
[thirdparty/man-pages.git] / man3 / pthread_mutexattr_getpshared.3
CommitLineData
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
27pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set
28process-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
39Compile and link with \fI\-pthread\fP.
40.SH DESCRIPTION
41These functions get and set the process-shared attribute
42in a mutex attributes object.
43This attribute must be appropriately set to ensure correct,
44efficient operation of a mutex created using this attributes object.
45.PP
46The process-shared attribute can have one of the following values:
47.TP
48.B PTHREAD_PROCESS_PRIVATE
49Mutexes created with this attributes object are to be shared
50only among threads in the same process that initialized the mutex.
51This is the default value for the process-shared mutex attribute.
52.TP
53.B PTHREAD_PROCESS_SHARED
54Mutexes created with this attributes object can be shared between
55any threads that have access to the memory containing the object,
56including threads in different processes.
57.PP
58.BR pthread_mutexattr_getpshared ()
59places the value of the process-shared attribute of
60the mutex attributes object referred to by
61.IR attr
62in the location pointed to by
63.IR pshared .
64.PP
65.BR pthread_mutexattr_setpshared ()
66sets the value of the process-shared attribute of
67the mutex attributes object referred to by
68.IR attr
69to the value specified in
70.BR pshared .
71.PP
72If
73.I attr
74does not refer to an initialized mutex attributes object,
75the behavior is undefined.
76.SH RETURN VALUE
77On success, these functions return 0.
78On error, they return a positive error number.
79.SH ERRORS
80.BR pthread_mutexattr_setpshared ()
81can fail with the following errors:
82.TP
83.B EINVAL
84The value specified in
85.I pshared
86is invalid.
87.TP
88.B ENOTSUP
89.I pshared is
90.BR PTHREAD_PROCESS_SHARED
91but the implementation does not support process-shared mutexes.
92.SH CONFORMING TO
93POSIX.1-2001, POSIX.1-2008.
94.SH SEE ALSO
95.ad l
96.nh
97.BR pthread_mutexattr_init (3),
98.BR pthreads (7)