|
1328 | 1328 | \label{BARRIER}
|
1329 | 1329 |
|
1330 | 1330 | \begin{itemize}
|
1331 |
| -\item The barrier API has been defined since SUSv3, see for example |
1332 |
| -\texttt{pthread\_\-barrier\_init}, however they can be created using |
1333 |
| -mutexes and condition variables. |
1334 |
| -\item The barrier API is non-mandatory part of POSIX (it belongs to |
1335 |
| -Advanced real-time threads extension) and hence SUS certified system does not |
1336 |
| -have to implement it, which is e.g. the case of macOS. |
1337 |
| -\item The barrier can be used e.g. in situation when it is necessary to perform |
1338 |
| -some initialization between individual phases of processing. The threads |
1339 |
| -need to wait for each other because the initialization can only begin |
1340 |
| -once the previous phase is over. |
| 1331 | +\item The barrier API has been defined since SUSv3, |
| 1332 | +The barrier API is non-mandatory part of POSIX (it belongs to |
| 1333 | +\emph{Advanced real-time threads extension}) and hence SUS certified system does |
| 1334 | +not have to implement it, which is e.g. the case of macOS. |
| 1335 | +However, a barrier can be implemented using mutexes and condition variables. |
| 1336 | +\item The barrier can be used e.g. in a situation when it is necessary to |
| 1337 | +perform some initialization between individual phases of processing. |
| 1338 | +The threads need to wait for each other because the initialization can only |
| 1339 | +begin once the previous phase is over. |
1341 | 1340 | Example \example{pthreads/pthread-barrier.c} shows the use in such case.
|
1342 | 1341 | \item \texttt{pthread\_barrier\_wait} returns
|
1343 | 1342 | the \texttt{PTHREAD\_BARRIER\_SERIAL\_THREAD} value
|
|
0 commit comments