DPC++ Runtime
Runtime libraries for oneAPI DPC++
cl::sycl::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 <CL/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 cl::sycl::detail::SpinLock::lock ( )
inline

Definition at line 29 of file spinlock.hpp.

◆ unlock()

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

Definition at line 33 of file spinlock.hpp.


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