00001
00002 #ifndef MThreadH
00003 #define MThreadH
00004 #include <boost/thread/thread.hpp>
00005
00006
00007 class MThread {
00008
00009 public:
00010
00011 MThread(bool a=false) : Active(a), Thread(NULL) {}
00012 virtual ~MThread() {}
00013
00014 virtual void operator()()=0;
00015 virtual void Start();
00016 virtual void Stop();
00017
00018 virtual void SetActive(bool a) {
00019 boost::mutex::scoped_lock lock(Mutex);
00020 Active = a;
00021 }
00022 virtual bool IsActive() {
00023 boost::mutex::scoped_lock lock(Mutex);
00024 return Active;
00025 }
00026
00027 private:
00028 boost::mutex Mutex;
00029 bool Active;
00030 boost::thread* Thread;
00031
00032 };
00033
00034 #endif
00035