From b0dc6b0dc89d499e0a481d97d41e9117d6b9de63 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 21 Apr 2008 13:53:02 -0500 Subject: [PATCH] Add a scope locker. --- Timeline/Mutex.H | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Timeline/Mutex.H b/Timeline/Mutex.H index 39b14e5..ba7d7fc 100644 --- a/Timeline/Mutex.H +++ b/Timeline/Mutex.H @@ -60,3 +60,22 @@ public: } }; + + +class Locker +{ + + Mutex &_lock; + +public: + + Locker ( Mutex & lock ) : _lock( lock ) + { + _lock.lock(); + } + + ~Locker ( ) + { + _lock.unlock(); + } +};