Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

TimerExecThread.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_TimerExecThread_h_
00003 #define INCLUDED_TimerExecThread_h_
00004 
00005 #include "IPC/PollThread.h"
00006 #include "Shared/Resource.h"
00007 
00008 //! executes EventRouter::processTimers() as necessary (allows timers to work without any other vision or sensor processing)
00009 class TimerExecThread : public PollThread {
00010 public:
00011   explicit TimerExecThread(Resource& bl, bool autoStart=true) : PollThread(), behaviorLock(bl) { if(autoStart) reset(); }
00012   virtual void reset(); //!< starts and stops thread as needed, or interrupts thread to reset sleep time if already running
00013   
00014 protected:
00015   virtual long calcSleepTime(); //!< returns the time in milliseconds to sleep until the next timer; resets PollThread::startTime
00016   virtual bool launched();
00017   virtual bool poll();
00018   virtual void interrupted();
00019 
00020   Resource& behaviorLock; //!< a lock on behaviors which should be obtained before processing timer events
00021 };
00022 
00023 /*! @file
00024  * @brief 
00025  * @author Ethan Tira-Thompson (ejt) (Creator)
00026  *
00027  * $Author: ejt $
00028  * $Name: tekkotsu-4_0 $
00029  * $Revision: 1.1 $
00030  * $State: Exp $
00031  * $Date: 2007/06/14 15:37:42 $
00032  */
00033 
00034 #endif

Tekkotsu Hardware Abstraction Layer 4.0
Generated Thu Nov 22 01:00:53 2007 by Doxygen 1.5.4