Inheritance diagram for Locker:
This class holds the synchronization object: constructor locks this object and destructor unlocks this object.
For example, the following code:
void f(Lockable &x) { x.enter(); // ... x.leave(); }
can be rewritten as:
void f(Lockable &x) { Locker guard(x); // ... }
Even exception was thrown during function execution, the synchronization object will be properly unlocked.
Lock synchronization object.
This constructor hold the synchronization object lock. And lock it by Lockable::enter() method calling.
[in,out] | lock | Synchronization object. |
~Locker | ( | ) |
Unlock synchronization object.
The destructor unlock the locked in constructor synchronization object.