This class provides simple critical sections functionality.
Definition at line 40 of file CCriticalSection.h.
#include <mrpt/synch/CCriticalSection.h>
Public Member Functions | |
CCriticalSection (const char *name=NULL) | |
Ctor. More... | |
virtual | ~CCriticalSection () |
Dtor. More... | |
void | enter () const MRPT_OVERRIDE |
Enter. More... | |
void | leave () const MRPT_OVERRIDE |
Leave. More... | |
bool | try_enter () const MRPT_OVERRIDE |
Returns true if adquired; false otherwise. More... | |
std::string | getName () const |
Returns the name used in the constructor. More... | |
Public Attributes | |
utils::CStream * | m_debugOut |
If set to a non-NULL value, debug messages regarding the calling threads IDs will be output. More... | |
Private Attributes | |
void * | m_data |
std::mutex*. Opaque ptr until MRPT 2.0.0 in which we could expose C++11 to user headers More... | |
std::string | m_name |
CCriticalSection::CCriticalSection | ( | const char * | name = NULL | ) |
Ctor.
Definition at line 25 of file CCriticalSection.cpp.
|
virtual |
|
virtual |
Enter.
If | the calling thread already possesses this critical section (it would be a dead-lock). |
Implements mrpt::synch::CAbstractMutex.
Definition at line 44 of file CCriticalSection.cpp.
References mrpt::system::getCurrentThreadId(), m_data, m_debugOut, m_name, and mrpt::utils::CStream::printf().
Referenced by mrpt::synch::MT_buffer::appendData(), mrpt::hwdrivers::C2DRangeFinderAbstract::bindIO(), mrpt::synch::MT_buffer::clear(), mrpt::slam::CMetricMapBuilder::enterCriticalSection(), mrpt::hwdrivers::C2DRangeFinderAbstract::getObservation(), my_CriticalSections_Multi(), my_CriticalSections_Simple(), mrpt::utils::CConsoleRedirector::overflow(), mrpt::synch::MT_buffer::read(), mrpt::synch::MT_buffer::readAndClear(), mrpt::synch::MT_buffer::size(), mrpt::utils::CConsoleRedirector::sync(), and mrpt::gui::WxSubsystem::waitWxShutdownsIfNoWindows().
std::string CCriticalSection::getName | ( | ) | const |
Returns the name used in the constructor.
Definition at line 39 of file CCriticalSection.cpp.
References m_name.
|
virtual |
Leave.
If | the calling thread is not the current owner of the critical section. |
Implements mrpt::synch::CAbstractMutex.
Definition at line 55 of file CCriticalSection.cpp.
References mrpt::system::getCurrentThreadId(), m_data, m_debugOut, m_name, and mrpt::utils::CStream::printf().
Referenced by mrpt::synch::MT_buffer::appendData(), mrpt::hwdrivers::C2DRangeFinderAbstract::bindIO(), mrpt::synch::MT_buffer::clear(), mrpt::hwdrivers::C2DRangeFinderAbstract::getObservation(), mrpt::slam::CMetricMapBuilder::leaveCriticalSection(), my_CriticalSections_Multi(), my_CriticalSections_Simple(), mrpt::utils::CConsoleRedirector::overflow(), mrpt::synch::MT_buffer::read(), mrpt::synch::MT_buffer::readAndClear(), mrpt::synch::MT_buffer::size(), mrpt::utils::CConsoleRedirector::sync(), and mrpt::gui::WxSubsystem::waitWxShutdownsIfNoWindows().
|
virtual |
Returns true if adquired; false otherwise.
Implements mrpt::synch::CAbstractMutex.
Definition at line 64 of file CCriticalSection.cpp.
References m_data.
|
private |
std::mutex*. Opaque ptr until MRPT 2.0.0 in which we could expose C++11 to user headers
Definition at line 43 of file CCriticalSection.h.
Referenced by enter(), leave(), try_enter(), and ~CCriticalSection().
utils::CStream* mrpt::synch::CCriticalSection::m_debugOut |
If set to a non-NULL value, debug messages regarding the calling threads IDs will be output.
Definition at line 57 of file CCriticalSection.h.
|
private |
Definition at line 44 of file CCriticalSection.h.
Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019 |