1PTHREAD_MUTEXATTR_GETPSHAREDL(i3n)ux Programmer's MaPnTuHaRlEAD_MUTEXATTR_GETPSHARED(3)
2
3
4

NAME

6       pthread_mutexattr_getpshared,  pthread_mutexattr_setpshared  -  get/set
7       process-shared mutex attribute
8

SYNOPSIS

10       #include <pthread.h>
11
12       int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
13                                        int *pshared);
14       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
15                                        int pshared);
16
17       Compile and link with -pthread.
18

DESCRIPTION

20       These functions get and set the process-shared  attribute  in  a  mutex
21       attributes  object.  This attribute must be appropriately set to ensure
22       correct, efficient operation of a mutex created using  this  attributes
23       object.
24
25       The process-shared attribute can have one of the following values:
26
27       PTHREAD_PROCESS_PRIVATE
28              Mutexes  created  with  this  attributes object are to be shared
29              only among threads in the  same  process  that  initialized  the
30              mutex.   This  is the default value for the process-shared mutex
31              attribute.
32
33       PTHREAD_PROCESS_SHARED
34              Mutexes created  with  this  attributes  object  can  be  shared
35              between  any  threads  that have access to the memory containing
36              the object, including threads in different processes.
37
38       pthread_mutexattr_getpshared() places the value of  the  process-shared
39       attribute  of  the  mutex  attributes object referred to by attr in the
40       location pointed to by pshared.
41
42       pthread_mutexattr_setpshared() sets the  value  of  the  process-shared
43       attribute  of  the  mutex  attributes object referred to by attr to the
44       value specified in pshared.
45
46       If attr does not refer to an initialized mutex attributes  object,  the
47       behavior is undefined.
48

RETURN VALUE

50       On success, these functions return 0.  On error, they return a positive
51       error number.
52

ERRORS

54       pthread_mutexattr_setpshared() can fail with the following errors:
55
56       EINVAL The value specified in pshared is invalid.
57
58       ENOTSUP
59              pshared is PTHREAD_PROCESS_SHARED but  the  implementation  does
60              not support process-shared mutexes.
61

CONFORMING TO

63       POSIX.1-2001, POSIX.1-2008.
64

SEE ALSO

66       pthread_mutexattr_init(3), pthreads(7)
67

COLOPHON

69       This page is part of release 4.15 of the Linux man-pages project.  A
70       description of the project, information about reporting bugs, and the
71       latest version of this page, can be found at
72       https://www.kernel.org/doc/man-pages/.
73
74
75
76Linux                             2017-09-13   PTHREAD_MUTEXATTR_GETPSHARED(3)
Impressum