SpECTRE
v2025.03.17
|
A simple spinlock implemented in std::atomic
s.
More...
#include <Spinlock.hpp>
Public Member Functions | |
Spinlock (const Spinlock &)=delete | |
Spinlock & | operator= (const Spinlock &)=delete |
Spinlock (Spinlock &&)=delete | |
Spinlock & | operator= (Spinlock &&)=delete |
void | lock () |
Acquire the lock. Will block until the lock is acquired. | |
bool | try_lock () |
Try to acquire the lock. More... | |
void | unlock () |
Release the lock. | |
A simple spinlock implemented in std::atomic
s.
Implementation adapted from https://rigtorp.se/spinlock/
|
inline |
Try to acquire the lock.
Returns true
if the lock was acquired, false
if it wasn't.