logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

pthread_barrier_wait.3p (4320B)


  1. '\" et
  2. .TH PTHREAD_BARRIER_WAIT "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. pthread_barrier_wait
  12. \(em synchronize at a barrier
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <pthread.h>
  17. .P
  18. int pthread_barrier_wait(pthread_barrier_t *\fIbarrier\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIpthread_barrier_wait\fR()
  23. function shall synchronize participating threads at the barrier
  24. referenced by
  25. .IR barrier .
  26. The calling thread shall block until the required number of
  27. threads have called
  28. \fIpthread_barrier_wait\fR()
  29. specifying the barrier.
  30. .P
  31. When the required number of threads have called
  32. \fIpthread_barrier_wait\fR()
  33. specifying the barrier, the constant PTHREAD_BARRIER_SERIAL_THREAD
  34. shall be returned to one unspecified thread and zero shall be returned
  35. to each of the remaining threads. At this point, the barrier shall be
  36. reset to the state it had as a result of the most recent
  37. \fIpthread_barrier_init\fR()
  38. function that referenced it.
  39. .P
  40. The constant PTHREAD_BARRIER_SERIAL_THREAD is defined in
  41. .IR <pthread.h>
  42. and its value shall be distinct from any other value returned by
  43. \fIpthread_barrier_wait\fR().
  44. .P
  45. The results are undefined if this function is called with an
  46. uninitialized barrier.
  47. .P
  48. If a signal is delivered to a thread blocked on a barrier, upon return
  49. from the signal handler the thread shall resume waiting at the barrier
  50. if the barrier wait has not completed (that is, if the required number
  51. of threads have not arrived at the barrier during the execution of the
  52. signal handler); otherwise, the thread shall continue as normal from
  53. the completed barrier wait. Until the thread in the signal handler
  54. returns from it, it is unspecified whether other threads may proceed
  55. past the barrier once they have all reached it.
  56. .P
  57. A thread that has blocked on a barrier shall not prevent any unblocked
  58. thread that is eligible to use the same processing resources from
  59. eventually making forward progress in its execution. Eligibility for
  60. processing resources shall be determined by the scheduling policy.
  61. .SH "RETURN VALUE"
  62. Upon successful completion, the
  63. \fIpthread_barrier_wait\fR()
  64. function shall return PTHREAD_BARRIER_SERIAL_THREAD for a single
  65. (arbitrary) thread synchronized at the barrier and zero for each of the
  66. other threads. Otherwise, an error number shall be returned to indicate
  67. the error.
  68. .SH ERRORS
  69. This function shall not return an error code of
  70. .BR [EINTR] .
  71. .LP
  72. .IR "The following sections are informative."
  73. .SH EXAMPLES
  74. None.
  75. .SH "APPLICATION USAGE"
  76. Applications using this function may be subject to priority inversion,
  77. as discussed in the Base Definitions volume of POSIX.1\(hy2017,
  78. .IR "Section 3.291" ", " "Priority Inversion".
  79. .SH RATIONALE
  80. If an implementation detects that the value specified by the
  81. .IR barrier
  82. argument to
  83. \fIpthread_barrier_wait\fR()
  84. does not refer to an initialized barrier object, it is recommended
  85. that the function should fail and report an
  86. .BR [EINVAL]
  87. error.
  88. .SH "FUTURE DIRECTIONS"
  89. None.
  90. .SH "SEE ALSO"
  91. .IR "\fIpthread_barrier_destroy\fR\^(\|)"
  92. .P
  93. The Base Definitions volume of POSIX.1\(hy2017,
  94. .IR "Section 3.291" ", " "Priority Inversion",
  95. .IR "Section 4.12" ", " "Memory Synchronization",
  96. .IR "\fB<pthread.h>\fP"
  97. .\"
  98. .SH COPYRIGHT
  99. Portions of this text are reprinted and reproduced in electronic form
  100. from IEEE Std 1003.1-2017, Standard for Information Technology
  101. -- Portable Operating System Interface (POSIX), The Open Group Base
  102. Specifications Issue 7, 2018 Edition,
  103. Copyright (C) 2018 by the Institute of
  104. Electrical and Electronics Engineers, Inc and The Open Group.
  105. In the event of any discrepancy between this version and the original IEEE and
  106. The Open Group Standard, the original IEEE and The Open Group Standard
  107. is the referee document. The original Standard can be obtained online at
  108. http://www.opengroup.org/unix/online.html .
  109. .PP
  110. Any typographical or formatting errors that appear
  111. in this page are most likely
  112. to have been introduced during the conversion of the source files to
  113. man page format. To report such errors, see
  114. https://www.kernel.org/doc/man-pages/reporting_bugs.html .