Ensure that a volatile read is used when reading *uaddr in the
compatibility implementation for sys_futex FUTEX_WAIT.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
#include <urcu/arch.h>
#include <urcu/futex.h>
+#include <urcu/system.h>
/*
* Using attribute "weak" for __urcu_compat_futex_lock and
* Comparing *uaddr content against val figures out which
* thread has been awakened.
*/
- while (*uaddr == val)
+ while (CMM_LOAD_SHARED(*uaddr) == val)
pthread_cond_wait(&__urcu_compat_futex_cond,
&__urcu_compat_futex_lock);
break;
switch (op) {
case FUTEX_WAIT:
- while (*uaddr == val)
+ while (CMM_LOAD_SHARED(*uaddr) == val)
poll(NULL, 0, 10);
break;
case FUTEX_WAKE: