diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/itolocker.cpp | 13 | ||||
-rw-r--r-- | src/itolocker.h | 18 |
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 | |||
4 | Bu::ItoLocker::ItoLocker( Bu::ItoMutex &mu ) : | ||
5 | mu( mu ) | ||
6 | { | ||
7 | mu.lock(); | ||
8 | } | ||
9 | |||
10 | Bu::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 | |||
4 | namespace 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 | ||