KiCad PCB EDA Suite
ScopedLock Struct Reference

An exception-safe scoped lock-keeper. More...

#include <openmp_mutex.h>

Public Member Functions

 ScopedLock (MutexType &m)
 
 ~ScopedLock ()
 
void Unlock ()
 
void LockAgain ()
 

Private Member Functions

void operator= (const ScopedLock &)
 
 ScopedLock (const ScopedLock &)
 

Private Attributes

MutexTypemut
 
bool locked
 

Detailed Description

An exception-safe scoped lock-keeper.

Definition at line 65 of file openmp_mutex.h.

Constructor & Destructor Documentation

ScopedLock::ScopedLock ( MutexType m)
inlineexplicit

Definition at line 67 of file openmp_mutex.h.

References MutexType::Lock(), and mut.

67 : mut( m ), locked( true ) { mut.Lock(); }
MutexType & mut
Definition: openmp_mutex.h:73
void Lock()
Definition: openmp_mutex.h:59
ScopedLock::~ScopedLock ( )
inline

Definition at line 68 of file openmp_mutex.h.

References Unlock().

68 { Unlock(); }
void Unlock()
Definition: openmp_mutex.h:69
ScopedLock::ScopedLock ( const ScopedLock )
private

Member Function Documentation

void ScopedLock::LockAgain ( )
inline

Definition at line 70 of file openmp_mutex.h.

References MutexType::Lock(), locked, and mut.

70 { if( locked ) return; mut.Lock(); locked = true; }
MutexType & mut
Definition: openmp_mutex.h:73
void Lock()
Definition: openmp_mutex.h:59
void ScopedLock::operator= ( const ScopedLock )
private
void ScopedLock::Unlock ( )
inline

Definition at line 69 of file openmp_mutex.h.

References locked, mut, and MutexType::Unlock().

Referenced by ~ScopedLock().

69 { if( !locked ) return; locked = false; mut.Unlock(); }
MutexType & mut
Definition: openmp_mutex.h:73
void Unlock()
Definition: openmp_mutex.h:60

Member Data Documentation

bool ScopedLock::locked
private

Definition at line 74 of file openmp_mutex.h.

Referenced by LockAgain(), and Unlock().

MutexType& ScopedLock::mut
private

Definition at line 73 of file openmp_mutex.h.

Referenced by LockAgain(), ScopedLock(), and Unlock().


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