Torque2D Reference
Loading...
Searching...
No Matches
Public Member Functions | List of all members
MutexHandle Class Reference

#include <mutex.h>

Public Member Functions

 MutexHandle ()
 
 ~MutexHandle ()
 
bool lock (void *mutex, bool blocking=false)
 
void unlock ()
 

Detailed Description

Helper for simplifying mutex locking code.

This class will automatically unlock a mutex that you've locked through it, saving you from managing a lot of complex exit cases. For instance:

MutexHandle handle;
handle.lock(myMutex);
if(error1)
return; // Auto-unlocked by handle if we leave here - normally would
// leave the mutex locked, causing much pain later.
handle.unlock();
Definition mutex.h:87
void unlock()
Definition mutex.h:118
bool lock(void *mutex, bool blocking=false)
Definition mutex.h:103

Constructor & Destructor Documentation

◆ MutexHandle()

MutexHandle ( )
inline

◆ ~MutexHandle()

~MutexHandle ( )
inline

Member Function Documentation

◆ lock()

bool lock ( void *  mutex,
bool  blocking = false 
)
inline

◆ unlock()

void unlock ( )
inline

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