lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds::SpinLock Class Reference

Busy-waiting lock on an atomic flag; satisfies the lock() and unlock() interface of std::lock_guard. More...

#include <SpinLock.hh>

Public Member Functions

 SpinLock ()
 Construct unlocked.
 
 ~SpinLock ()=default
 Defaulted destructor.
 
 SpinLock (const SpinLock &)=delete
 Deleted: a lock cannot be copied.
 
SpinLock & operator= (const SpinLock &)=delete
 Deleted: a lock cannot be copy-assigned.
 
void lock ()
 Spin until the flag is acquired, executing a pause instruction and yielding the thread between attempts.
 
void unlock ()
 Clear the flag.
 

Detailed Description

Busy-waiting lock on an atomic flag; satisfies the lock() and unlock() interface of std::lock_guard.

Not copyable.

Constructor & Destructor Documentation

◆ SpinLock() [1/2]

Pds::SpinLock::SpinLock ( )
inline

Construct unlocked.

◆ ~SpinLock()

Pds::SpinLock::~SpinLock ( )
default

Defaulted destructor.

◆ SpinLock() [2/2]

Pds::SpinLock::SpinLock ( const SpinLock &  )
delete

Deleted: a lock cannot be copied.

Member Function Documentation

◆ lock()

void Pds::SpinLock::lock ( )
inline

Spin until the flag is acquired, executing a pause instruction and yielding the thread between attempts.

◆ operator=()

SpinLock & Pds::SpinLock::operator= ( const SpinLock &  )
delete

Deleted: a lock cannot be copy-assigned.

◆ unlock()

void Pds::SpinLock::unlock ( )
inline

Clear the flag.


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