X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=urcu.c;h=c5abeafa06d3bd796a2148a1effdf90c2c959dd1;hb=143f99b421adc86061c6ce9e70dc932e12303658;hp=5cb470bcaea9e61b312a8e2d839c14ab88eacc80;hpb=66bc4dcd6d823e527395bac6755c17718c3f8e71;p=userspace-rcu.git diff --git a/urcu.c b/urcu.c index 5cb470b..c5abeaf 100644 --- a/urcu.c +++ b/urcu.c @@ -26,6 +26,7 @@ #define _BSD_SOURCE #define _GNU_SOURCE #define _LGPL_SOURCE +#define _DEFAULT_SOURCE #include #include #include @@ -223,9 +224,22 @@ static void wait_gp(void) { /* Read reader_gp before read futex */ smp_mb_master(RCU_MB_GROUP); - if (uatomic_read(&gp_futex) == -1) - futex_async(&gp_futex, FUTEX_WAIT, -1, - NULL, NULL, 0); + if (uatomic_read(&gp_futex) != -1) + return; + while (futex_async(&gp_futex, FUTEX_WAIT, -1, + NULL, NULL, 0)) { + switch (errno) { + case EWOULDBLOCK: + /* Value already changed. */ + return; + case EINTR: + /* Retry if interrupted by signal. */ + break; /* Get out of switch. */ + default: + /* Unexpected error. */ + urcu_die(errno); + } + } } /*