00001 #include "ThreadSLAM.h" 00002 00003 namespace ohm_tsd_slam 00004 { 00005 00006 ThreadSLAM::ThreadSLAM(obvious::TsdGrid& grid): 00007 _thread(new boost::thread(&ThreadSLAM::eventLoop, this)), 00008 _stayActive(true), 00009 _grid(grid) 00010 { 00011 00012 } 00013 00014 ThreadSLAM::~ThreadSLAM() 00015 { 00016 delete _thread; 00017 } 00018 00019 void ThreadSLAM::unblock(void) 00020 { 00021 _sleepCond.notify_all(); 00022 } 00023 00024 bool ThreadSLAM::alive(unsigned int ms) 00025 { 00026 return(_thread->timed_join(boost::posix_time::milliseconds(ms))); 00027 } 00028 00029 void ThreadSLAM::terminateThread(void) 00030 { 00031 _stayActive = false; 00032 this->unblock(); 00033 } 00034 00035 } /* namespace */