3#ifndef XRPL_BASICS_SPINLOCK_H_INCLUDED
4#define XRPL_BASICS_SPINLOCK_H_INCLUDED
6#include <xrpl/beast/utility/instrumentation.h>
33 asm volatile(
"yield");
83 "std::atomic<T>::fetch_and(T) and std::atomic<T>::fetch_and(T) are required by packed_spinlock");
107 index >= 0 && (
mask_ != 0),
108 "ripple::packed_spinlock::packed_spinlock : valid index and mask");
180 return lock_.compare_exchange_weak(
Classes to handle arrays of spinlocks packed into a single atomic integer:
packed_spinlock(std::atomic< T > &lock, int index)
A single spinlock packed inside the specified atomic.
packed_spinlock(packed_spinlock const &)=delete
packed_spinlock & operator=(packed_spinlock const &)=delete
A spinlock implemented on top of an atomic integer.
spinlock & operator=(spinlock const &)=delete
spinlock(spinlock const &)=delete
spinlock(std::atomic< T > &lock)
Grabs the.
void spin_pause() 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.