Add a scope locker.

This commit is contained in:
Jonathan Moore Liles 2008-04-21 13:53:02 -05:00
parent 8a0da04a4b
commit b0dc6b0dc8
1 changed files with 19 additions and 0 deletions

View File

@ -60,3 +60,22 @@ public:
}
};
class Locker
{
Mutex &_lock;
public:
Locker ( Mutex & lock ) : _lock( lock )
{
_lock.lock();
}
~Locker ( )
{
_lock.unlock();
}
};