pthread_barrier_wait.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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_BARRIER_WAIT&quot;(P) manual page</TITLE>
  6. <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Linux)">
  7. <META NAME="CREATED" CONTENT="20050504;11484200">
  8. <META NAME="CHANGEDBY" CONTENT="Ross Johnson">
  9. <META NAME="CHANGED" CONTENT="20060408;9504600">
  10. <!-- manual page source format generated by PolyglotMan v3.2, -->
  11. <!-- available at http://polyglotman.sourceforge.net/ -->
  12. </HEAD>
  13. <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR">
  14. <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4>
  15. <P><A HREF="index.html">Reference Index</A></P>
  16. <P><A HREF="#toc">Table of Contents</A></P>
  17. <H2><A HREF="#toc0" NAME="sect0">Name</A></H2>
  18. <P>pthread_barrier_wait - synchronize at a barrier (<B>ADVANCED
  19. 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_barrier_wait(pthread_barrier_t *</B><I>barrier</I><B>);
  25. </B>
  26. </P>
  27. <H2><A HREF="#toc2" NAME="sect2">Description</A></H2>
  28. <P>The <B>pthread_barrier_wait</B> function shall synchronize
  29. participating threads at the barrier referenced by <I>barrier</I>.
  30. The calling thread shall block until the required number of threads
  31. have called <B>pthread_barrier_wait</B> specifying the barrier.
  32. </P>
  33. <P>When the required number of threads have called
  34. <B>pthread_barrier_wait</B> specifying the barrier, the constant
  35. <B>PTHREAD_BARRIER_SERIAL_THREAD</B> shall be returned to one
  36. unspecified thread and zero shall be returned to each of the
  37. remaining threads. At this point, the barrier shall be reset to the
  38. state it had as a result of the most recent <A HREF="pthread_barrier_init.html"><B>pthread_barrier_init</B>(3)</A>
  39. function that referenced it.
  40. </P>
  41. <P>The constant <B>PTHREAD_BARRIER_SERIAL_THREAD</B> is defined in
  42. <I>&lt;pthread.h&gt;</I> and its value shall be distinct from any
  43. other value returned by <B>pthread_barrier_wait</B> .
  44. </P>
  45. <P>The results are undefined if this function is called with an
  46. uninitialized barrier.
  47. </P>
  48. <P>If a signal is delivered to a thread blocked on a barrier, upon
  49. return from the signal handler the thread shall resume waiting at the
  50. barrier if the barrier wait has not completed (that is, if the
  51. required number of threads have not arrived at the barrier during the
  52. execution of the signal handler); otherwise, the thread shall
  53. continue as normal from the completed barrier wait. Until the thread
  54. in the signal handler returns from it, it is unspecified whether
  55. other threads may proceed past the barrier once they have all reached
  56. it.
  57. </P>
  58. <P>A thread that has blocked on a barrier shall not prevent any
  59. unblocked thread that is eligible to use the same processing
  60. resources from eventually making forward progress in its execution.
  61. Eligibility for processing resources shall be determined by the
  62. scheduling policy.
  63. </P>
  64. <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
  65. <P>Upon successful completion, the <B>pthread_barrier_wait</B>
  66. function shall return <B>PTHREAD_BARRIER_SERIAL_THREAD</B> for a
  67. single (arbitrary) thread synchronized at the barrier and zero for
  68. each of the other threads. Otherwise, an error number shall be
  69. returned to indicate the error.
  70. </P>
  71. <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2>
  72. <P>The <B>pthread_barrier_wait</B> function may fail if:
  73. </P>
  74. <DL>
  75. <DT><B>EINVAL</B>
  76. </DT><DD STYLE="margin-bottom: 0.5cm">
  77. The value specified by <I>barrier</I> does not refer to an
  78. initialized barrier object.
  79. </DD></DL>
  80. <P>
  81. This function shall not return an error code of [EINTR].
  82. </P>
  83. <P><I>The following sections are informative.</I>
  84. </P>
  85. <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2>
  86. <P>None.
  87. </P>
  88. <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2>
  89. <P>Applications using this function may be subject to priority
  90. inversion, as discussed in the Base Definitions volume of
  91. IEEE&nbsp;Std&nbsp;1003.1-2001, Section 3.285, Priority Inversion.
  92. </P>
  93. <P>The <B>pthread_barrier_wait</B> function is part of the Barriers
  94. option and need not be provided on all implementations.
  95. </P>
  96. <P><B>Pthreads-w32</B> defines <B>_POSIX_BARRIERS</B> to indicate
  97. that this routine is implemented and may be used.</P>
  98. <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2>
  99. <P>None.
  100. </P>
  101. <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2>
  102. <P>None.
  103. </P>
  104. <H2><A HREF="#toc11" NAME="sect11">Known Bugs</A></H2>
  105. <DL>
  106. None.</DL>
  107. <H2>
  108. <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. <A HREF="pthread_barrier_init.html"><B>pthread_barrier_init(3)</B></A>,
  111. the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001,
  112. <I>&lt;pthread.h&gt;</I>
  113. </P>
  114. <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2>
  115. <P>Portions of this text are reprinted and reproduced in electronic
  116. form from IEEE Std 1003.1, 2003 Edition, Standard for Information
  117. Technology -- Portable Operating System Interface (POSIX), The Open
  118. Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the
  119. Institute of Electrical and Electronics Engineers, Inc and The Open
  120. Group. In the event of any discrepancy between this version and the
  121. original IEEE and The Open Group Standard, the original IEEE and The
  122. Open Group Standard is the referee document. The original Standard
  123. can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A>
  124. .
  125. </P>
  126. <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
  127. <HR>
  128. <P><A NAME="toc"></A><B>Table of Contents</B></P>
  129. <UL>
  130. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A>
  131. </P>
  132. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A>
  133. </P>
  134. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A>
  135. </P>
  136. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return
  137. Value</A>
  138. </P>
  139. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A>
  140. </P>
  141. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A>
  142. </P>
  143. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application
  144. Usage</A>
  145. </P>
  146. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A>
  147. </P>
  148. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future
  149. Directions</A>
  150. </P>
  151. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect11" NAME="toc11">Known
  152. Bugs</A>
  153. </P>
  154. <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See
  155. Also</A>
  156. </P>
  157. <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A>
  158. </P>
  159. </UL>
  160. </BODY>
  161. </HTML>