5#include <xrpl/beast/utility/instrumentation.h>
32 asm volatile(
"yield");
82 "std::atomic<T>::fetch_and(T) and std::atomic<T>::fetch_and(T) are required by packed_spinlock");
105 index >= 0 && (
mask_ != 0),
106 "xrpl::PackedSpinlock::PackedSpinlock : valid index and mask");
112 return (
bits_.fetch_or(
mask_, std::memory_order_acquire) &
mask_) == 0;
124 while ((
bits_.load(std::memory_order_relaxed) &
mask_) != 0)
132 bits_.fetch_and(~
mask_, std::memory_order_release);
178 return lock_.compare_exchange_weak(
181 std::memory_order_acquire,
182 std::memory_order_relaxed);
194 while (
lock_.load(std::memory_order_relaxed) != 0)
202 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.