pthread_barrierattr_setpshared.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
  5. <TITLE>&quot;PTHREAD_BARRIERATTR_GETPSHARED&quot;(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/ -->
  11. </HEAD>
  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>)
  20. </P>
  21. <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2>
  22. <P><B>#include &lt;pthread.h&gt; </B>
  23. </P>
  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>
  28. </P>
  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>.
  35. </P>
  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>&lt;pthread.h&gt;</I>.
  46. </P>
  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.
  53. </P>
  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
  59. the error.
  60. </P>
  61. <P>If successful, the <B>pthread_barrierattr_setpshared</B> function
  62. shall return zero; otherwise, an error number shall be returned to
  63. indicate the error.
  64. </P>
  65. <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2>
  66. <P>These functions may fail if:
  67. </P>
  68. <DL>
  69. <DT><B>EINVAL</B>
  70. </DT><DD STYLE="margin-bottom: 0.5cm">
  71. The value specified by <I>attr</I> is invalid.
  72. </DD><DT>
  73. The <B>pthread_barrierattr_setpshared</B> function may fail if:
  74. </DT><DT>
  75. <B>EINVAL</B>
  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>.
  80. </DD><DT>
  81. <B>ENOSYS</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>
  85. <P>
  86. These functions shall not return an error code of [EINTR].
  87. </P>
  88. <P><I>The following sections are informative.</I>
  89. </P>
  90. <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2>
  91. <P>None.
  92. </P>
  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.
  97. </P>
  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>
  103. <P>None.
  104. </P>
  105. <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2>
  106. <P>None.
  107. </P>
  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&nbsp;Std&nbsp;1003.1-2001,
  113. <I>&lt;pthread.h&gt;</I>
  114. </P>
  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>
  125. .
  126. </P>
  127. <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
  128. <HR>
  129. <P><A NAME="toc"></A><B>Table of Contents</B></P>
  130. <UL>
  131. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
  132. </P>
  133. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
  134. </P>
  135. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
  136. </P>
  137. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
  138. Value</A>
  139. </P>
  140. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
  141. </P>
  142. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A>
  143. </P>
  144. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application
  145. Usage</A>
  146. </P>
  147. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A>
  148. </P>
  149. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future
  150. Directions</A>
  151. </P>
  152. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See
  153. Also</A>
  154. </P>
  155. <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A>
  156. </P>
  157. </UL>
  158. </BODY>
  159. </HTML>