MutexHandle

Engine/source/platform/threads/mutex.h

Helper for simplifying mutex locking code.

More...

Private Attributes

Public Functions

bool
lock(void * mutex, bool blocking)

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();

Private Attributes

void * mMutexPtr 

Public Functions

MutexHandle()

~MutexHandle()

lock(void * mutex, bool blocking)

unlock()