1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
4
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
5
<TITLE>"PTHREAD_BARRIERATTR_GETPSHARED"(P) manual page</TITLE>
6
<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)">
7
<META NAME="CREATED" CONTENT="20050504;11552100">
8
<META NAME="CHANGED" CONTENT="20050505;18080400">
9
<!-- manual page source format generated by PolyglotMan v3.2, -->
10
<!-- available at http://polyglotman.sourceforge.net/ -->
12
<BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR">
13
<H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4>
14
<P><A HREF="index.html">Reference Index</A></P>
15
<P><A HREF="#toc">Table of Contents</A></P>
16
<H2><A HREF="#toc0" NAME="sect0">Name</A></H2>
17
<P>pthread_barrierattr_getpshared, pthread_barrierattr_setpshared -
18
get and set the process-shared attribute of the barrier attributes
19
object (<B>ADVANCED REALTIME THREADS</B>)
21
<H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2>
22
<P><B>#include <pthread.h> </B>
24
<P><B>int pthread_barrierattr_getpshared(const pthread_barrierattr_t
25
* restrict</B> <I>attr</I><B>, int *restrict</B> <I>pshared</I><B>);
26
<BR>int pthread_barrierattr_setpshared(pthread_barrierattr_t *</B><I>attr</I><B>,
27
int</B> <I>pshared</I><B>); </B>
29
<H2><A HREF="#toc2" NAME="sect2">Description</A></H2>
30
<P>The <B>pthread_barrierattr_getpshared</B> function shall obtain
31
the value of the <I>process-shared</I> attribute from the attributes
32
object referenced by <I>attr</I>. The <B>pthread_barrierattr_setpshared</B>
33
function shall set the <I>process-shared</I> attribute in an
34
initialized attributes object referenced by <I>attr</I>.
36
<P>The <I>process-shared</I> attribute is set to
37
PTHREAD_PROCESS_SHARED to permit a barrier to be operated upon by any
38
thread that has access to the memory where the barrier is allocated.
39
If the <I>process-shared</I> attribute is PTHREAD_PROCESS_PRIVATE,
40
the barrier shall only be operated upon by threads created within the
41
same process as the thread that initialized the barrier; if threads
42
of different processes attempt to operate on such a barrier, the
43
behavior is undefined. The default value of the attribute shall be
44
PTHREAD_PROCESS_PRIVATE. Both constants PTHREAD_PROCESS_SHARED and
45
PTHREAD_PROCESS_PRIVATE are defined in <I><pthread.h></I>.
47
<P><B>Pthreads-w32</B> defines _<B>POSIX_THREAD_PROCESS_SHARED</B> in
48
pthread.h as -1 to indicate that these routines are implemented but
49
that the process shared attribute is not supported.</P>
50
<P>Additional attributes, their default values, and the names of the
51
associated functions to get and set those attribute values are
52
implementation-defined.
54
<H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
55
<P>If successful, the <B>pthread_barrierattr_getpshared</B> function
56
shall return zero and store the value of the <I>process-shared</I>
57
attribute of <I>attr</I> into the object referenced by the <I>pshared</I>
58
parameter. Otherwise, an error number shall be returned to indicate
61
<P>If successful, the <B>pthread_barrierattr_setpshared</B> function
62
shall return zero; otherwise, an error number shall be returned to
65
<H2><A HREF="#toc4" NAME="sect4">Errors</A></H2>
66
<P>These functions may fail if:
70
</DT><DD STYLE="margin-bottom: 0.5cm">
71
The value specified by <I>attr</I> is invalid.
73
The <B>pthread_barrierattr_setpshared</B> function may fail if:
76
</DT><DD STYLE="margin-bottom: 0.5cm">
77
The new value specified for the <I>process-shared</I> attribute is
78
not one of the legal values <B>PTHREAD_PROCESS_SHARED</B> or
79
<B>PTHREAD_PROCESS_PRIVATE</B>.
82
</DT><DD STYLE="margin-bottom: 0.5cm">
83
The value specified by <I>attr</I> was <B>PTHREAD_PROCESS_SHARED</B>
84
(Pthreads-w32).</DD></DL>
86
These functions shall not return an error code of [EINTR].
88
<P><I>The following sections are informative.</I>
90
<H2><A HREF="#toc5" NAME="sect5">Examples</A></H2>
93
<H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2>
94
<P>The <B>pthread_barrierattr_getpshared</B> and
95
<B>pthread_barrierattr_setpshared</B> functions are part of the
96
Barriers option and need not be provided on all implementations.
98
<P><B>Pthreads-w32</B> defines <B>_POSIX_BARRIERS</B> and
99
<B>_POSIX_THREAD_PROCESS_SHARED</B> in pthread.h as -1 to indicate
100
that these routines are implemented and may be used, but do not
101
support the process shared option.</P>
102
<H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2>
105
<H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2>
108
<H2><A HREF="#toc9" NAME="sect9">See Also</A></H2>
109
<P><A HREF="pthread_barrier_init.html"><B>pthread_barrier_destroy</B>(3)</A>
110
<B>,</B> <A HREF="pthread_barrierattr_init.html"><B>pthread_barrierattr_destroy</B>(3)</A>
111
<B>,</B> <A HREF="pthread_barrierattr_init.html"><B>pthread_barrierattr_init</B>(3)</A>
112
<B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001,
113
<I><pthread.h></I>
115
<H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2>
116
<P>Portions of this text are reprinted and reproduced in electronic
117
form from IEEE Std 1003.1, 2003 Edition, Standard for Information
118
Technology -- Portable Operating System Interface (POSIX), The Open
119
Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the
120
Institute of Electrical and Electronics Engineers, Inc and The Open
121
Group. In the event of any discrepancy between this version and the
122
original IEEE and The Open Group Standard, the original IEEE and The
123
Open Group Standard is the referee document. The original Standard
124
can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A>
127
<P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
129
<P><A NAME="toc"></A><B>Table of Contents</B></P>
131
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
133
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
135
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
137
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
140
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
142
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A>
144
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application
147
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A>
149
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future
152
<LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See
155
<LI><P><A HREF="#sect10" NAME="toc10">Copyright</A>