AnimatLab
2
Test
|
Standard critical section. More...
#include <StdCriticalSectionInternal.h>
Classes | |
class | InternalLocker |
Internal locker. More... | |
Public Member Functions | |
CStdCriticalSectionInternal () | |
Default constructor. More... | |
~CStdCriticalSectionInternal () | |
Destructor. More... | |
bool | Enter (long lMilliTimeout=-1) |
Try's to enter the critical section. Waits until it can get in, or until timeout. More... | |
bool | Leave () |
Leaves this critical section. More... | |
bool | TryEnter () |
Gets the try enter. More... | |
Public Member Functions inherited from StdUtils::CStdCriticalSection | |
CStdCriticalSection () | |
Default constructor. More... | |
~CStdCriticalSection () | |
Destructor. More... | |
Protected Attributes | |
bool | m_bOwned |
boost::thread::id | m_dwOwner |
std::atomic< int > | m_iBusy |
Tells if this critical section is currently being used. | |
ULONG | m_ulRefCnt |
The number of reference counts to this critical section. | |
Friends | |
class | InternalLocker |
Standard critical section.
This is a critical section class used to lock a section of code. This is primarily used when multithreading to prevent multiple threads from modifying the same resources.
Definition at line 50 of file StdCriticalSectionInternal.h.
StdUtils::CStdCriticalSectionInternal::CStdCriticalSectionInternal | ( | ) |
StdUtils::CStdCriticalSectionInternal::~CStdCriticalSectionInternal | ( | ) |
Destructor.
This releases the critical section lock if one was gained with a TryEnter call
Definition at line 114 of file StdCriticalSectionInternal.cpp.
References Leave().
bool StdUtils::CStdCriticalSectionInternal::Enter | ( | long | lMilliTimeout = -1 | ) |
Try's to enter the critical section. Waits until it can get in, or until timeout.
lMilliTimeout | The milli timeout. |
Definition at line 172 of file StdCriticalSectionInternal.cpp.
References TryEnter().
|
virtual |
Leaves this critical section.
This unlocks the critical section for the current thread if the current thread already owns the critical section and it only has one "lock" on the critical section. If the lock count (the number of times the same thread has it locked) is greater than one, then the count is simply decremented.
Implements StdUtils::CStdCriticalSection.
Definition at line 213 of file StdCriticalSectionInternal.cpp.
References m_iBusy, and m_ulRefCnt.
Referenced by ~CStdCriticalSectionInternal().
|
virtual |
Gets the try enter.
This locks the critical section for the current thread if no other thread already owns the critical section. If the current thread already owns the critical section and this is reentry, the current thread is allowed to pass
Implements StdUtils::CStdCriticalSection.
Definition at line 135 of file StdCriticalSectionInternal.cpp.
References m_iBusy, and m_ulRefCnt.
Referenced by Enter().