Class UScopeMutex

Class Documentation

class UScopeMutex

Automatically lock the referenced mutex on constructor and unlock mutex on destructor.

Example:

UMutex m; // Mutex shared with another thread(s).
...
int myMethod()
{
   UScopeMutex sm(m); // automatically lock the mutex m
   if(cond1)
   {
      return 1; // automatically unlock the mutex m
   }
   else if(cond2)
   {
      return 2; // automatically unlock the mutex m
   }
   return 0; // automatically unlock the mutex m
}

See also

UMutex

Public Functions

inline UScopeMutex(const UMutex &mutex)
inline UScopeMutex(UMutex *mutex)
inline ~UScopeMutex()