SpinLock is a synchronization primitive, that uses atomic variable and causes thread trying acquire lock wait in loop while repeatedly check if the lock is available. More...
#include <sycl/detail/spinlock.hpp>
Public Member Functions | |
void | lock () |
void | unlock () |
SpinLock is a synchronization primitive, that uses atomic variable and causes thread trying acquire lock wait in loop while repeatedly check if the lock is available.
One important feature of this implementation is that std::atomic<bool> can be zero-initialized. This allows SpinLock to have trivial constructor and destructor, which makes it possible to use it in global context (unlike std::mutex, that doesn't provide such guarantees).
Definition at line 27 of file spinlock.hpp.
|
inline |
Definition at line 29 of file spinlock.hpp.
|
inline |
Definition at line 33 of file spinlock.hpp.