Isle
Loading...
Searching...
No Matches
MxAutoLock Class Reference

[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...
 

Detailed Description

[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.

Constructor & Destructor Documentation

◆ MxAutoLock()

MxAutoLock::MxAutoLock ( MxCriticalSection p_criticalSection)

[AI] Constructs an auto locker and acquires the lock on the given critical section.

[AI]

Parameters
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::~MxAutoLock ( )

[AI] Destructor releases (leaves) the critical section if it was acquired. [AI]

Definition at line 18 of file mxautolock.cpp.


The documentation for this class was generated from the following files: