Public Member Functions | |
PROUD_API | CriticalSection () |
PROUD_API | CriticalSection (CriticalSectionSettings &settings) |
PROUD_API | ~CriticalSection (void) |
PROUD_API void | Lock () |
PROUD_API void | UnsafeLock () |
PROUD_API void | Unlock () |
PROUD_API bool | TryLock () |
PROUD_API bool | IsValid () |
bool | IsLockedByCurrentThread () const |
bool | IsLocked () const |
void | Reset (CriticalSectionSettings &settings) |
void | ShowErrorOnInvalidState () |
uint64_t | GetLastLockedThreadID () |
Public Attributes | |
bool | m_neverCallDtor |
int | m_tryLockSuccessCount |
int | m_tryLockFailCount |
Critical section (class)
PROUD_API Proud::CriticalSection::CriticalSection | ( | ) |
Initializes a critical section object.
PROUD_API Proud::CriticalSection::CriticalSection | ( | CriticalSectionSettings & | settings | ) |
Initializes a critical section object.
PROUD_API Proud::CriticalSection::~CriticalSection | ( | void | ) |
Destroyer
uint64_t Proud::CriticalSection::GetLastLockedThreadID | ( | ) |
returns ID of the thread where the last acquire (lock) is done.
This value does not set to zero if last unacquire (unlock) is done. You must set Proud.CriticalSectionSettings.m_updateLastLockedThreadID to true before using this function.
NOTE: on unix, this is pthread_t value. This may differ from thread ID shown in debugger.
bool Proud::CriticalSection::IsLocked | ( | ) | const |
Returns true if this is locked by any thread.
bool Proud::CriticalSection::IsLockedByCurrentThread | ( | ) | const |
Returns true if this is locked by current thread.
PROUD_API void Proud::CriticalSection::Lock | ( | ) |
The critical section is to be occupied by the thread calling this method.
PROUD_API bool Proud::CriticalSection::TryLock | ( | ) |
Use TryEnterCriticalSection rather than EnterCriticalSection.
PROUD_API void Proud::CriticalSection::Unlock | ( | ) |
The critical section is to be relieved by the thread calling this method.
PROUD_API void Proud::CriticalSection::UnsafeLock | ( | ) |
TODO:translate needed. The critical section is to be occupied by the thread calling this method.