futex.2: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-03-03 09:05:30 +01:00
parent 63ad44cb92
commit 83e80dda44
1 changed files with 3 additions and 0 deletions

View File

@ -1583,11 +1583,14 @@ fwait(int *futexp)
the GCC Manual. */
while (1) {
/* Is the futex available? */
if (__sync_bool_compare_and_swap(futexp, 1, 0))
break; /* Yes */
/* Futex is not available; wait */
s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);
if (s == \-1 && errno != EAGAIN)
errExit("futex\-FUTEX_WAIT");