X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FFIFORunner.hh;h=756f07fc4db38f98536ec8d3778f95c95ff6bc50;hb=925317c7f45c32b01ab9292023db3f372b74bf0f;hp=9121445fecb097c6045c6eeb937ff3dbd910e2fe;hpb=40fa3e3f1e0f639c68bd15bf469e35045f94abee;p=senf.git diff --git a/Scheduler/FIFORunner.hh b/Scheduler/FIFORunner.hh index 9121445..756f07f 100644 --- a/Scheduler/FIFORunner.hh +++ b/Scheduler/FIFORunner.hh @@ -31,11 +31,15 @@ #include #include "../boost/intrusive/ilist.hpp" #include "../boost/intrusive/ilist_hook.hpp" +#include "../Utils/singleton.hh" //#include "FIFORunner.mpp" ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { + + class Scheduler; + namespace scheduler { /** \brief Task execution scheduler @@ -48,7 +52,7 @@ namespace scheduler { is posted for the task. */ class FIFORunner - : boost::noncopyable + : public singleton { public: struct TaskInfo; @@ -56,8 +60,7 @@ namespace scheduler { private: struct TaskListTag; typedef boost::intrusive::ilist_base_hook TaskListBase; - typedef TaskListBase::value_traits TaskListType; - typedef boost::intrusive::ilist TaskList; + typedef boost::intrusive::ilist, false> TaskList; public: /////////////////////////////////////////////////////////////////////////// @@ -89,8 +92,8 @@ namespace scheduler { ///\name Structors and default members ///@{ - FIFORunner(); - ~FIFORunner(); + using singleton::instance; + using singleton::alive; ///@} /////////////////////////////////////////////////////////////////////////// @@ -100,6 +103,9 @@ namespace scheduler { void run(); ///< Run queue + void taskTimeout(unsigned ms); ///< Set task timeout to \a ms milliseconds + unsigned taskTimeout() const; ///< Get task timeout in milliseconds + unsigned hangCount() const; ///< Number of task expirations /**< The FIFORunner manages a watchdog which checks, that a single task does not run continuously for a longer time @@ -109,16 +115,24 @@ namespace scheduler { protected: private: + FIFORunner(); + ~FIFORunner(); + static void watchdog(int, siginfo_t *, void *); TaskList tasks_; TaskList::iterator next_; - int watchdogId_; + timer_t watchdogId_; + unsigned watchdogMs_; std::string runningName_; # ifdef SENF_DEBUG std::string runningBacktrace_; # endif + unsigned watchdogCount_; unsigned hangCount_; + + friend class singleton; + friend class senf::Scheduler; };