We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c661a38 commit 37e30a8Copy full SHA for 37e30a8
1 file changed
include/ipfixprobe/outputPlugin/outputStorage/spinlock.hpp
@@ -1,5 +1,7 @@
1
#pragma once
2
3
+#include "backoffScheme.hpp"
4
+
5
#include <atomic>
6
#include <cstddef>
7
#include <cstdint>
@@ -13,9 +15,10 @@ class Spinlock {
13
15
public:
14
16
void lock() noexcept
17
{
18
+ BackoffScheme backoffScheme(20, std::numeric_limits<std::size_t>::max());
19
while (flag.test(std::memory_order_relaxed)
20
|| flag.test_and_set(std::memory_order_acquire)) {
- std::this_thread::yield();
21
+ backoffScheme.backoff();
22
}
23
24
0 commit comments