Pothos  0.7.0-gf7fbae99
The Pothos dataflow programming software suite
Public Member Functions | List of all members
Pothos::Util::SpinLock Class Reference

#include <SpinLock.hpp>

Public Member Functions

 SpinLock (void)
 Create a new unlocked spin lock. More...
 
bool try_lock (void) noexcept
 Try to lock, return true for lock. More...
 
void lock (void) noexcept
 Lock the spin lock, block if already locked. More...
 
void unlock (void) noexcept
 Unlock the spin lock (should be already locked) More...
 

Detailed Description

A generic spin lock implementation using std::atomic.

There are no embedded back-off or sleep conditions in this lock, therefore only use this lock to protect very brief code sections.

This lock can be used with std::lock_guard<Pothos::Util::SpinLock>

Constructor & Destructor Documentation

◆ SpinLock()

Pothos::Util::SpinLock::SpinLock ( void  )
inline

Create a new unlocked spin lock.

Member Function Documentation

◆ lock()

void Pothos::Util::SpinLock::lock ( void  )
inlinenoexcept

Lock the spin lock, block if already locked.

◆ try_lock()

bool Pothos::Util::SpinLock::try_lock ( void  )
inlinenoexcept

Try to lock, return true for lock.

◆ unlock()

void Pothos::Util::SpinLock::unlock ( void  )
inlinenoexcept

Unlock the spin lock (should be already locked)


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