|
SpECTRE
v2025.08.19
|
A simple spinlock implemented in std::atomics.
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::atomics.
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.