INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
thread.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef GBXICEUTILACFR_THREAD_H 00012 #define GBXICEUTILACFR_THREAD_H 00013 00014 #include <IceUtil/Thread.h> 00015 00016 namespace gbxsickacfr { 00017 namespace gbxiceutilacfr { 00018 00069 class Thread : public IceUtil::Thread 00070 { 00071 public: 00072 00073 Thread(); 00074 00077 void stop(); 00078 00080 bool isStarted(); 00081 00083 bool isStopping(); 00084 00088 bool isActive() { return !isStopping(); }; 00089 00090 protected: 00091 00096 void waitForStop(); 00097 00098 private: 00099 bool isStopping_; 00100 }; 00102 typedef IceUtil::Handle<gbxiceutilacfr::Thread> ThreadPtr; 00103 00106 void stopAndJoin( gbxiceutilacfr::Thread* thread ); 00107 00110 void stopAndJoin( const gbxiceutilacfr::ThreadPtr& thread ); 00111 00116 void checkedSleep( const gbxiceutilacfr::ThreadPtr& thread, IceUtil::Time duration, int checkIntervalMs=250 ); 00117 00118 } 00119 } // end namespace 00120 00121 #endif |