diff options
Diffstat (limited to 'libgomp/config/linux/wait.h')
-rw-r--r-- | libgomp/config/linux/wait.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libgomp/config/linux/wait.h b/libgomp/config/linux/wait.h index 0e8abf111b0..4f659855811 100644 --- a/libgomp/config/linux/wait.h +++ b/libgomp/config/linux/wait.h @@ -44,7 +44,7 @@ extern long int gomp_futex_wait, gomp_futex_wake; #include <futex.h> -static inline void do_wait (int *addr, int val) +static inline int do_spin (int *addr, int val) { unsigned long long i, count = gomp_spin_count_var; @@ -52,10 +52,16 @@ static inline void do_wait (int *addr, int val) count = gomp_throttled_spin_count_var; for (i = 0; i < count; i++) if (__builtin_expect (*addr != val, 0)) - return; + return 0; else cpu_relax (); - futex_wait (addr, val); + return 1; +} + +static inline void do_wait (int *addr, int val) +{ + if (do_spin (addr, val)) + futex_wait (addr, val); } #ifdef HAVE_ATTRIBUTE_VISIBILITY |