summaryrefslogtreecommitdiffhomepage
path: root/compat/spinlock.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'compat/spinlock.hpp')
-rw-r--r--compat/spinlock.hpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/compat/spinlock.hpp b/compat/spinlock.hpp
deleted file mode 100644
index b94df7c8..00000000
--- a/compat/spinlock.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#pragma once
-
-#include "export.hpp"
-#include "macros1.h"
-#include <atomic>
-
-struct OTR_COMPAT_EXPORT spinlock_guard final
-{
- spinlock_guard(const spinlock_guard&) = delete;
- spinlock_guard& operator=(const spinlock_guard&) = delete;
- constexpr spinlock_guard(spinlock_guard&&) noexcept = default;
-
- cc_forceinline
- spinlock_guard(std::atomic_flag* lock) noexcept : spinlock_guard(*lock) {}
-
- cc_forceinline
- spinlock_guard(std::atomic_flag& lock) noexcept : lock(lock)
- {
- while (lock.test_and_set(std::memory_order_acquire))
- (void)0;
- }
-
- cc_forceinline
- ~spinlock_guard() noexcept
- {
- lock.clear(std::memory_order_release);
- }
-
-private:
- std::atomic_flag& lock;
-};