Isle
|
[AI] Provides a critical section object for mutual exclusion with optional use of OS mutex. More...
#include <mxcriticalsection.h>
Public Member Functions | |
MxCriticalSection () | |
[AI] Constructs the critical section object. More... | |
~MxCriticalSection () | |
[AI] Destroys the critical section object. More... | |
void | Enter () |
[AI] Acquires/gains entry to the critical section or mutex, blocking if not available. More... | |
void | Leave () |
[AI] Releases/leaves the critical section or mutex. More... | |
Static Public Member Functions | |
static void | SetDoMutex () |
[AI] Globally enforces the use of mutexes for all subsequent MxCriticalSection allocation. More... | |
[AI] Provides a critical section object for mutual exclusion with optional use of OS mutex.
[AI] MxCriticalSection encapsulates synchronization for threads, primarily using a Windows CRITICAL_SECTION, but with an optional fallback to a mutex depending on the runtime global setting. This is useful for cross-process synchronization or for debugging/compatibility scenarios where mutexes are required instead of critical sections (process-local). The mechanism is selected per process via SetDoMutex(). [AI]
Definition at line 10 of file mxcriticalsection.h.
MxCriticalSection::MxCriticalSection | ( | ) |
[AI] Constructs the critical section object.
[AI] Initializes either a CRITICAL_SECTION or a mutex depending on the global g_useMutex flag. If mutex is activated, uses a Windows kernel mutex instead of the faster, process-local CRITICAL_SECTION. [AI]
Definition at line 13 of file mxcriticalsection.cpp.
MxCriticalSection::~MxCriticalSection | ( | ) |
[AI] Destroys the critical section object.
[AI] Deallocates any OS resources tied to the mutex or CRITICAL_SECTION, ensuring proper cleanup and deadlock protection. [AI]
Definition at line 28 of file mxcriticalsection.cpp.
void MxCriticalSection::Enter | ( | ) |
[AI] Acquires/gains entry to the critical section or mutex, blocking if not available.
[AI] Waits (potentially blocks) until the section can be entered. If using a mutex, will abort the process and log to DEADLOCK.TXT if a timeout or failure occurs, to aid diagnosing deadlocks. [AI]
Definition at line 40 of file mxcriticalsection.cpp.
void MxCriticalSection::Leave | ( | ) |
[AI] Releases/leaves the critical section or mutex.
[AI] Signals that the calling thread has exited the protected area; resource is made available to the next thread waiting (if any). [AI]
Definition at line 63 of file mxcriticalsection.cpp.
|
static |
[AI] Globally enforces the use of mutexes for all subsequent MxCriticalSection allocation.
[AI] If called before instantiating MxCriticalSection instances, all new instances use OS mutexes rather than CRITICAL_SECTIONs. This is useful for debugging deadlocks or forcing cross-process mutual exclusion when required. [AI]
Definition at line 74 of file mxcriticalsection.cpp.