diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-04-28 17:34:07 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-04-28 17:34:07 +0200 |
commit | 15bce81a42273c35e10f158b74cb3a999189d12e (patch) | |
tree | d8995d26ed2cf15677979170a67237332b6e62f6 /vespalib | |
parent | 1121b538077fd8bd7957630c84565f2854b999f7 (diff) |
Use yield instead of pause on arm.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/time.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/util/time.cpp b/vespalib/src/vespa/vespalib/util/time.cpp index 341102bf9ff..a732eb215fb 100644 --- a/vespalib/src/vespa/vespalib/util/time.cpp +++ b/vespalib/src/vespa/vespalib/util/time.cpp @@ -2,7 +2,9 @@ #include "time.h" #include <thread> +#ifdef __x86_64__ #include <immintrin.h> +#endif namespace vespalib { @@ -43,7 +45,13 @@ Timer::waitAtLeast(duration dur, bool busyWait) { steady_clock::time_point deadline = steady_clock::now() + dur; while (steady_clock::now() < deadline) { for (int i = 0; i < 1000; i++) { +#if defined(__x86_64__) _mm_pause(); +#elif defined(__aarch64__) + __asm__ __volatile__ ("yield"); +#else +#warning "Missing yield" +#endif } } } else { |