Isle
|
[AI] Provides automatic RAII-style locking and unlocking for a critical section. More...
#include <mxautolock.h>
Public Member Functions | |
MxAutoLock (MxCriticalSection *p_criticalSection) | |
[AI] Constructs an auto locker and acquires the lock on the given critical section. More... | |
~MxAutoLock () | |
[AI] Destructor releases (leaves) the critical section if it was acquired. [AI] More... | |
[AI] Provides automatic RAII-style locking and unlocking for a critical section.
When an instance is created, it enters the provided critical section, and on destruction, it leaves it. This pattern ensures exception-safe critical section management and reduces the likelihood of forgetting to unlock.
[AI] The constructor immediately enters the critical section if it is not null. The destructor leaves the section if still valid. Intended for use with the AUTOLOCK macro on code blocks that need mutual exclusion. [AI]
Definition at line 12 of file mxautolock.h.
MxAutoLock::MxAutoLock | ( | MxCriticalSection * | p_criticalSection | ) |
[AI] Constructs an auto locker and acquires the lock on the given critical section.
[AI]
p_criticalSection | [AI] The critical section to be locked by this object. Must not be deleted while this object exists. [AI] |
Definition at line 7 of file mxautolock.cpp.
MxAutoLock::~MxAutoLock | ( | ) |
[AI] Destructor releases (leaves) the critical section if it was acquired. [AI]
Definition at line 18 of file mxautolock.cpp.