1PTHREAD_MUTEXATTR_GETPSHAREDP(O3SPI)X Programmer's MPaTnHuRaElAD_MUTEXATTR_GETPSHARED(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       pthread_mutexattr_getpshared, pthread_mutexattr_setpshared  —  get  and
14       set the process-shared attribute
15

SYNOPSIS

17       #include <pthread.h>
18
19       int pthread_mutexattr_getpshared(const pthread_mutexattr_t
20           *restrict attr, int *restrict pshared);
21       int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr,
22           int pshared);
23

DESCRIPTION

25       The  pthread_mutexattr_getpshared()  function shall obtain the value of
26       the process-shared attribute from the attributes object  referenced  by
27       attr.
28
29       The  pthread_mutexattr_setpshared()  function  shall  set  the process-
30       shared attribute in an  initialized  attributes  object  referenced  by
31       attr.
32
33       The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit
34       a mutex to be operated upon by any thread that has access to the memory
35       where  the mutex is allocated, even if the mutex is allocated in memory
36       that is shared by multiple processes. If the  process-shared  attribute
37       is  PTHREAD_PROCESS_PRIVATE,  the  mutex shall only be operated upon by
38       threads created within the same process as the thread that  initialized
39       the mutex; if threads of differing processes attempt to operate on such
40       a mutex, the behavior is undefined. The default value of the  attribute
41       shall be PTHREAD_PROCESS_PRIVATE.
42
43       The  behavior  is undefined if the value specified by the attr argument
44       to  pthread_mutexattr_getpshared()  or   pthread_mutexattr_setpshared()
45       does not refer to an initialized mutex attributes object.
46

RETURN VALUE

48       Upon successful completion, pthread_mutexattr_setpshared() shall return
49       zero; otherwise, an error number shall  be  returned  to  indicate  the
50       error.
51
52       Upon successful completion, pthread_mutexattr_getpshared() shall return
53       zero and store the value of the process-shared attribute of  attr  into
54       the  object  referenced  by  the pshared parameter. Otherwise, an error
55       number shall be returned to indicate the error.
56

ERRORS

58       The pthread_mutexattr_setpshared() function may fail if:
59
60       EINVAL The new value specified for the attribute is outside  the  range
61              of legal values for that attribute.
62
63       These functions shall not return an error code of [EINTR].
64
65       The following sections are informative.
66

EXAMPLES

68       None.
69

APPLICATION USAGE

71       None.
72

RATIONALE

74       If an implementation detects that the value specified by the attr argu‐
75       ment  to  pthread_mutexattr_getpshared()   or   pthread_mutexattr_setp‐
76       shared()  does  not refer to an initialized mutex attributes object, it
77       is recommended that the function should fail  and  report  an  [EINVAL]
78       error.
79

FUTURE DIRECTIONS

81       None.
82

SEE ALSO

84       pthread_cond_destroy(), pthread_create(), pthread_mutex_destroy(),
85       pthread_mutexattr_destroy()
86
87       The Base Definitions volume of POSIX.1‐2008, <pthread.h>
88
90       Portions of this text are reprinted and reproduced in  electronic  form
91       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
92       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
93       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
94       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
95       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
96       event of any discrepancy between this version and the original IEEE and
97       The  Open Group Standard, the original IEEE and The Open Group Standard
98       is the referee document. The original Standard can be  obtained  online
99       at http://www.unix.org/online.html .
100
101       Any  typographical  or  formatting  errors that appear in this page are
102       most likely to have been introduced during the conversion of the source
103       files  to  man page format. To report such errors, see https://www.ker
104       nel.org/doc/man-pages/reporting_bugs.html .
105
106
107
108IEEE/The Open Group                  2013     PTHREAD_MUTEXATTR_GETPSHARED(3P)
Impressum