X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FFIFORunner.hh;h=756f07fc4db38f98536ec8d3778f95c95ff6bc50;hb=925317c7f45c32b01ab9292023db3f372b74bf0f;hp=adf088fbeaab98db3cc4d1d64d15ac3d5821811b;hpb=ee63e5771e9d69c7fe6de6c1b53b92d1307f2fc1;p=senf.git diff --git a/Scheduler/FIFORunner.hh b/Scheduler/FIFORunner.hh index adf088f..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_; 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; };