DPC++ Runtime
Runtime libraries for oneAPI DPC++
sycl::_V1::detail::SpinLock Class Reference

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 ()
 

Detailed Description

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.

Member Function Documentation

◆ lock()

void sycl::_V1::detail::SpinLock::lock ( )
inline

Definition at line 29 of file spinlock.hpp.

◆ unlock()

void sycl::_V1::detail::SpinLock::unlock ( )
inline

Definition at line 33 of file spinlock.hpp.


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