diff options
Diffstat (limited to 'libitm/config/linux')
-rw-r--r-- | libitm/config/linux/futex_bits.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libitm/config/linux/futex_bits.h b/libitm/config/linux/futex_bits.h index 62d83d1..dc1eb1f 100644 --- a/libitm/config/linux/futex_bits.h +++ b/libitm/config/linux/futex_bits.h @@ -31,9 +31,13 @@ #include <unistd.h> #include <sys/syscall.h> +#include <errno.h> static inline long sys_futex0 (std::atomic<int> *addr, long op, long val) { - return syscall (SYS_futex, (int*) addr, op, val, 0); + long res = syscall (SYS_futex, (int*) addr, op, val, 0); + if (__builtin_expect (res == -1, 0)) + return -errno; + return res; } |