1 .\" Copyright (c) 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH pthread_mutexattr_getpshared 3 (date) "Linux man-pages (unreleased)"
7 pthread_mutexattr_getpshared, pthread_mutexattr_setpshared \- get/set
8 process-shared mutex attribute
11 .RI ( libpthread ", " \-lpthread )
14 .B #include <pthread.h>
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 );
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.
28 The process-shared attribute can have one of the following values:
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.
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.
40 .BR pthread_mutexattr_getpshared ()
41 places the value of the process-shared attribute of
42 the mutex attributes object referred to by
44 in the location pointed to by
47 .BR pthread_mutexattr_setpshared ()
48 sets the value of the process-shared attribute of
49 the mutex attributes object referred to by
51 to the value specified in
56 does not refer to an initialized mutex attributes object,
57 the behavior is undefined.
59 On success, these functions return 0.
60 On error, they return a positive error number.
62 .BR pthread_mutexattr_setpshared ()
63 can fail with the following errors:
66 The value specified in
72 .B PTHREAD_PROCESS_SHARED
73 but the implementation does not support process-shared mutexes.
75 POSIX.1-2001, POSIX.1-2008.
79 .BR pthread_mutexattr_init (3),