5#include <xrpl/beast/utility/instrumentation.h>
33 asm volatile(
"yield");
85 "std::atomic<T>::fetch_and(T) and std::atomic<T>::fetch_and(T) are required by packed_spinlock");
109 index >= 0 && (
mask_ != 0),
110 "xrpl::PackedSpinlock::PackedSpinlock : valid index and mask");
116 return (
bits_.fetch_or(
mask_, std::memory_order_acquire) &
mask_) == 0;
128 while ((
bits_.load(std::memory_order_relaxed) &
mask_) != 0)
136 bits_.fetch_and(~
mask_, std::memory_order_release);
184 return lock_.compare_exchange_weak(
187 std::memory_order_acquire,
188 std::memory_order_relaxed);
200 while (
lock_.load(std::memory_order_relaxed) != 0)
208 lock_.store(0, std::memory_order_release);
PackedSpinlock(PackedSpinlock const &)=delete
PackedSpinlock(std::atomic< T > &lock, int index)
A single spinlock packed inside the specified atomic.
PackedSpinlock & operator=(PackedSpinlock const &)=delete
Spinlock(Spinlock const &)=delete
Spinlock(std::atomic< T > &lock)
Grabs the.
Spinlock & operator=(Spinlock const &)=delete
void spinPause() noexcept
Inform the processor that we are in a tight spin-wait loop.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.