Subversion Repositories HomeAutomation

Rev

Rev 1317 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * Thread.h
  3.  *
  4.  *  Created on: Apr 26, 2009
  5.  *      Author: Mattias Runge
  6.  */
  7.  
  8. #ifndef THREAD_H_
  9. #define THREAD_H_
  10.  
  11. #include <boost/thread.hpp>
  12.  
  13. namespace atom {
  14. namespace thread {
  15.  
  16. class Thread
  17. {
  18. public:
  19.     Thread();
  20.     virtual ~Thread();
  21.  
  22.     void Start();
  23.     void Stop();
  24.     boost::thread::id GetId();
  25.     bool IsRunning();
  26.  
  27. protected:
  28.     virtual void Run() = 0;
  29.  
  30. private:
  31.     boost::thread thread_;
  32.     bool is_running_;
  33.  
  34.     void RunBase();
  35. };
  36.  
  37. } // namespace thread
  38. } // namespace atom
  39.  
  40. #endif /* THREAD_H_ */
  41.