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 
00028 #endif

Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:39 2016 by Doxygen 1.6.3