uLib
User mode C/C++ extended API library for Win32 programmers.
|
#include <uLib/SyncObj.h>
TCritSec adds some cotton-gloving to critical sections.
It prevents direct access to the CRITICAL_SECTION, prevents copying,
and protects against reinitializing an already initialized section.
It also automatically deletes the section when it goes out of scope.
Note: Keep the following MSDN remark in mind...
"EnterCriticalSection can raise EXCEPTION_POSSIBLE_DEADLOCK
if a wait operation on the critical section times out. Do not handle
a possible deadlock exception; instead, debug the application."
Public Functions | |
TCritSec () | |
TCritSec (DWORD SpinCount) | |
~TCritSec () | |
DWORD | SetSpinCount (DWORD SpinCount) |
void | Enter () |
bool | TryEnter () |
void | Leave () |
Protected Attributes | |
CRITICAL_SECTION | _cSec |
TCritSec::TCritSec | ( | ) |
Definition at line 29 of file SyncObj.cpp.
TCritSec::TCritSec | ( | DWORD | SpinCount | ) |
See SetSpinCount().
Definition at line 46 of file SyncObj.cpp.
TCritSec::~TCritSec | ( | ) |
Definition at line 62 of file SyncObj.cpp.
See [MSDN] SetCriticalSectionSpinCount().
Definition at line 67 of file SyncObj.cpp.
void TCritSec::Enter | ( | ) |
See [MSDN] EnterCriticalSection().
Definition at line 93 of file SyncObj.cpp.
bool TCritSec::TryEnter | ( | ) |
See [MSDN] TryEnterCriticalSection().
Definition at line 111 of file SyncObj.cpp.
void TCritSec::Leave | ( | ) |
See [MSDN] LeaveCriticalSection().
Definition at line 116 of file SyncObj.cpp.