summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2020-11-13 09:53:28 +0000
committerHåvard Pettersen <havardpe@oath.com>2020-11-13 09:53:28 +0000
commit76f13a1c63f2a35fbf90190679c79f1c169f6f10 (patch)
tree9093179154caa41795d754b7f256b02c60acc8c2 /vespalib
parent7201a4f8b2e54686f6898998fc5b9c9962f3f20e (diff)
use yield instead of pause
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/util/spin_lock.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/util/spin_lock.h b/vespalib/src/vespa/vespalib/util/spin_lock.h
index 9a7d1bb47bd..01e1794b3e5 100644
--- a/vespalib/src/vespa/vespalib/util/spin_lock.h
+++ b/vespalib/src/vespa/vespalib/util/spin_lock.h
@@ -1,6 +1,7 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <atomic>
+#include <thread>
namespace vespalib {
@@ -32,7 +33,7 @@ public:
void lock() noexcept {
while (__builtin_expect(_lock.exchange(true, std::memory_order_acquire), false)) {
while (_lock.load(std::memory_order_relaxed)) {
- __builtin_ia32_pause();
+ std::this_thread::yield();
}
}
}