A class acquiring a CCriticalSection at its constructor, and releasing it at destructor.
It is a better idea to always use CCriticalSectionLocker, since it is more secure in the case of possible exceptions, many different exit points from a function, etc.. : it will always release the critical section at the destructor. Example:
Definition at line 75 of file CCriticalSection.h.
#include <mrpt/synch/CCriticalSection.h>
Public Member Functions | |
CCriticalSectionLocker (const CCriticalSection *cs) | |
Constructor: enters the critical section. More... | |
CCriticalSectionLocker (const CCriticalSectionLocker &o) | |
CCriticalSectionLocker & | operator= (const CCriticalSectionLocker &o) |
~CCriticalSectionLocker () | |
Destructor: leaves the critical section. More... | |
Protected Attributes | |
const CCriticalSection * | m_cs |
mrpt::synch::CCriticalSectionLocker::CCriticalSectionLocker | ( | const CCriticalSection * | cs | ) |
Constructor: enters the critical section.
|
inline |
Definition at line 86 of file CCriticalSection.h.
mrpt::synch::CCriticalSectionLocker::~CCriticalSectionLocker | ( | ) |
Destructor: leaves the critical section.
|
inline |
Definition at line 90 of file CCriticalSection.h.
References m_cs.
|
protected |
Definition at line 78 of file CCriticalSection.h.
Referenced by operator=().
Page generated by Doxygen 1.8.13 for MRPT 1.4.0 SVN: at Fri Mar 17 07:27:15 UTC 2017 |