Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014 #ifndef BIG_LOCK_H
00015 #define BIG_LOCK_H
00016
00017 #include <boost/thread.hpp>
00018
00024 template<int dummy>
00025 struct big_lock {
00026 big_lock() {
00027 m_big_lock.lock();
00028 m_unlocked = false;
00029 }
00030 ~big_lock() {
00031 if (!m_unlocked) {
00032 m_unlocked = true;
00033 m_big_lock.unlock();
00034 }
00035 }
00036 void unlock() {
00037 m_unlocked = true;
00038 m_big_lock.unlock();
00039 }
00040 private:
00041 static boost::mutex m_big_lock;
00042 bool m_unlocked;
00043 };
00044
00045 template<int dummy>
00046 boost::mutex big_lock<dummy>::m_big_lock;
00047
00048 #endif // BIG_LOCK_H