Public Member Functions | Private Attributes | List of all members
UScopeMutex Class Reference

#include <UMutex.h>

Public Member Functions

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

Private Attributes

const UMutexmutex_
 

Detailed Description

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

Definition at line 157 of file UMutex.h.

Constructor & Destructor Documentation

UScopeMutex::UScopeMutex ( const UMutex mutex)
inline

Definition at line 160 of file UMutex.h.

UScopeMutex::UScopeMutex ( UMutex mutex)
inline

Definition at line 166 of file UMutex.h.

UScopeMutex::~UScopeMutex ( )
inline

Definition at line 171 of file UMutex.h.

Member Data Documentation

const UMutex& UScopeMutex::mutex_
private

Definition at line 176 of file UMutex.h.


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


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Mon Jun 10 2019 13:21:32