Guard.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00020 #ifndef COIL_GUARD_H
00021 #define COIL_GUARD_H
00022 
00023 #include <coil/Mutex.h>
00024 
00025 namespace coil
00026 {
00040   template <class M>
00041   class Guard
00042   {
00043   public:
00044 
00064     Guard(M& mutex) : m_mutex(mutex)
00065     {
00066       m_mutex.lock();
00067     }
00068 
00084     ~Guard()
00085     {
00086       m_mutex.unlock();
00087     }
00088 
00089   private:
00090     Guard(const Guard&);
00091     Guard& operator=(const Guard&);
00092     M& m_mutex;
00093   };
00094 };
00095 #endif // COIL_GUARD_H


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Thu Aug 27 2015 14:16:37