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-2010 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 #include <gbxutilacfr/stoppable.h> 00016 // this is not needed for implementation of this class. 00017 // it's included for convenience of users of Thread class. 00018 #include <gbxsickacfr/gbxiceutilacfr/threadutils.h> 00019 00020 namespace gbxiceutilacfr { 00021 00072 class Thread : public IceUtil::Thread, public gbxutilacfr::Stoppable 00073 { 00074 public: 00075 00076 Thread(); 00077 00080 void stop(); 00081 00082 // from gbxutilacfr::Stoppable 00084 virtual bool isStopping(); 00085 00087 bool isStarted(); 00088 00092 bool isActive() { return !isStopping(); }; 00093 00094 protected: 00095 00100 void waitForStop(); 00101 00102 private: 00103 bool isStopping_; 00104 }; 00106 typedef IceUtil::Handle<gbxiceutilacfr::Thread> ThreadPtr; 00107 00110 void stop( gbxiceutilacfr::Thread* thread ); 00111 00114 void stopAndJoin( gbxiceutilacfr::Thread* thread ); 00115 00118 inline void stop( const gbxiceutilacfr::ThreadPtr& thread ) 00119 { stop(thread.get()); } 00120 00123 inline void stopAndJoin( const gbxiceutilacfr::ThreadPtr& thread ) 00124 { stopAndJoin(thread.get()); } 00125 00126 } // end namespace 00127 00128 #endif |