]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_mutexattr_getpshared.3
Revert "src.mk, All pages: Move man* to man/"
[thirdparty/man-pages.git] / man3 / pthread_mutexattr_getpshared.3
CommitLineData
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
7pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set
8process-shared mutex attribute
fba5d1c4
AC
9.SH LIBRARY
10POSIX 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
23These functions get and set the process-shared attribute
24in a mutex attributes object.
25This attribute must be appropriately set to ensure correct,
26efficient operation of a mutex created using this attributes object.
27.PP
28The process-shared attribute can have one of the following values:
29.TP
30.B PTHREAD_PROCESS_PRIVATE
31Mutexes created with this attributes object are to be shared
32only among threads in the same process that initialized the mutex.
33This is the default value for the process-shared mutex attribute.
34.TP
35.B PTHREAD_PROCESS_SHARED
36Mutexes created with this attributes object can be shared between
37any threads that have access to the memory containing the object,
38including threads in different processes.
39.PP
40.BR pthread_mutexattr_getpshared ()
41places the value of the process-shared attribute of
42the mutex attributes object referred to by
1ae6b2c7 43.I attr
b967efeb
MK
44in the location pointed to by
45.IR pshared .
46.PP
47.BR pthread_mutexattr_setpshared ()
48sets the value of the process-shared attribute of
49the mutex attributes object referred to by
1ae6b2c7 50.I attr
b967efeb
MK
51to the value specified in
52.BR pshared .
53.PP
54If
55.I attr
56does not refer to an initialized mutex attributes object,
57the behavior is undefined.
58.SH RETURN VALUE
59On success, these functions return 0.
60On error, they return a positive error number.
61.SH ERRORS
62.BR pthread_mutexattr_setpshared ()
63can fail with the following errors:
64.TP
65.B EINVAL
66The value specified in
67.I pshared
68is invalid.
69.TP
70.B ENOTSUP
71.I pshared is
1ae6b2c7 72.B PTHREAD_PROCESS_SHARED
b967efeb 73but the implementation does not support process-shared mutexes.
3113c7f3 74.SH STANDARDS
b967efeb
MK
75POSIX.1-2001, POSIX.1-2008.
76.SH SEE ALSO
77.ad l
78.nh
79.BR pthread_mutexattr_init (3),
80.BR pthreads (7)