aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-08-25 06:48:24 +0000
committerMike Buland <eichlan@xagasoft.com>2011-08-25 06:48:24 +0000
commit6df767863656d2e3efffed562a02180b3ea11624 (patch)
tree93253944bfe829fddf40ccb3d120967f66a8a419 /src
parentbc6952f06b9d1cff7417d3f71ce5a65704ebbb02 (diff)
downloadlibbu++-6df767863656d2e3efffed562a02180b3ea11624.tar.gz
libbu++-6df767863656d2e3efffed562a02180b3ea11624.tar.bz2
libbu++-6df767863656d2e3efffed562a02180b3ea11624.tar.xz
libbu++-6df767863656d2e3efffed562a02180b3ea11624.zip
Bu::ItoLocker is rather handy, I like it. I reccomend it.
Diffstat (limited to 'src')
-rw-r--r--src/itolocker.cpp13
-rw-r--r--src/itolocker.h18
2 files changed, 31 insertions, 0 deletions
diff --git a/src/itolocker.cpp b/src/itolocker.cpp
new file mode 100644
index 0000000..17e97fd
--- /dev/null
+++ b/src/itolocker.cpp
@@ -0,0 +1,13 @@
1#include "bu/itolocker.h"
2#include "bu/itomutex.h"
3
4Bu::ItoLocker::ItoLocker( Bu::ItoMutex &mu ) :
5 mu( mu )
6{
7 mu.lock();
8}
9
10Bu::ItoLocker::~ItoLocker()
11{
12 mu.unlock();
13}
diff --git a/src/itolocker.h b/src/itolocker.h
new file mode 100644
index 0000000..76e5198
--- /dev/null
+++ b/src/itolocker.h
@@ -0,0 +1,18 @@
1#ifndef BU_ITO_LOCKER_H
2#define BU_ITO_LOCKER_H
3
4namespace Bu
5{
6 class ItoMutex;
7 class ItoLocker
8 {
9 public:
10 ItoLocker( ItoMutex &mu );
11 virtual ~ItoLocker();
12
13 private:
14 ItoMutex & mu;
15 };
16};
17
18#endif