SpECTRE  v2024.04.12
Parallel::Spinlock Class Reference

A simple spinlock implemented in std::atomics. More...

#include <Spinlock.hpp>

Public Member Functions

 Spinlock (const Spinlock &)=delete
 
Spinlockoperator= (const Spinlock &)=delete
 
 Spinlock (Spinlock &&)=delete
 
Spinlockoperator= (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.
 

Detailed Description

A simple spinlock implemented in std::atomics.

Implementation adapted from https://rigtorp.se/spinlock/

Member Function Documentation

◆ try_lock()

bool Parallel::Spinlock::try_lock ( )
inline

Try to acquire the lock.

Returns true if the lock was acquired, false if it wasn't.


The documentation for this class was generated from the following file: