Public Member Functions | Private Types | Private Attributes | List of all members
icl_core::thread::SpinLock Class Reference

#include <SpinLock.h>

Public Member Functions

bool lock ()
 
 SpinLock ()
 
bool tryLock ()
 
void unlock ()
 Unlocks the mutex. More...
 

Private Types

enum  LockState { LOCKED, UNLOCKED }
 States of the lock. More...
 

Private Attributes

boost::atomic< LockStatem_state
 Current lock state. More...
 

Detailed Description

A spin lock for very short critical sections. Busy-waits until the lock is acquired. Modeled after the example given in the boost::atomic documentation.

Definition at line 35 of file SpinLock.h.

Member Enumeration Documentation

States of the lock.

Enumerator
LOCKED 
UNLOCKED 

Definition at line 73 of file SpinLock.h.

Constructor & Destructor Documentation

icl_core::thread::SpinLock::SpinLock ( )
inline

Definition at line 38 of file SpinLock.h.

Member Function Documentation

bool icl_core::thread::SpinLock::lock ( )
inline

Locks the mutex. Busy-waits until the mutex can be locked.

Returns
true. When the function returns the mutex is guaranteed to be locked.

Definition at line 46 of file SpinLock.h.

bool icl_core::thread::SpinLock::tryLock ( )
inline

Tries to lock the mutex without blocking. The mutex is locked if it is available.

Returns
true if the mutex has been locked, false otherwise.

Definition at line 60 of file SpinLock.h.

void icl_core::thread::SpinLock::unlock ( )
inline

Unlocks the mutex.

Definition at line 66 of file SpinLock.h.

Member Data Documentation

boost::atomic<LockState> icl_core::thread::SpinLock::m_state
private

Current lock state.

Definition at line 80 of file SpinLock.h.


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


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:59