UtiLite
0.3.1
A lite utilities library
|
#include <UMutex.h>
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 }