X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FFIFORunner.hh;h=6513f72396485bc575b2e800e995376db6438915;hb=a1fdb7bb122f0b05be809a922d4b7ef5e125fa67;hp=40154d38f23a29834c95780d7b8690eeb277d4b2;hpb=989a3b185a4e8854a1a1a01c5b190c9e6dcaf2af;p=senf.git diff --git a/Scheduler/FIFORunner.hh b/Scheduler/FIFORunner.hh index 40154d3..6513f72 100644 --- a/Scheduler/FIFORunner.hh +++ b/Scheduler/FIFORunner.hh @@ -23,8 +23,8 @@ /** \file \brief FIFORunner public header */ -#ifndef HH_FIFORunner_ -#define HH_FIFORunner_ 1 +#ifndef HH_SENF_Scheduler_FIFORunner_ +#define HH_SENF_Scheduler_FIFORunner_ 1 // Custom includes #include @@ -61,7 +61,9 @@ namespace detail { public TaskListBase { public: - explicit TaskInfo(std::string const & name); + enum Priority { PRIORITY_LOW = 0, PRIORITY_NORMAL = 1, PRIORITY_HIGH = 2 }; + + explicit TaskInfo(std::string const & name, Priority priority=PRIORITY_NORMAL); virtual ~TaskInfo(); void run(); @@ -76,6 +78,7 @@ namespace detail { virtual bool v_enabled() const; bool runnable_; + Priority priority_; # ifdef SENF_DEBUG std::string backtrace_; # endif @@ -96,12 +99,19 @@ namespace detail { void taskTimeout(unsigned ms); unsigned taskTimeout() const; + void abortOnTimeout(bool flag); + bool abortOnTimeout() const; + + void startWatchdog(); + void stopWatchdog(); - unsigned hangCount() const; + unsigned hangCount(); iterator begin() const; iterator end() const; + void yield(); + protected: private: @@ -110,16 +120,35 @@ namespace detail { static void watchdog(int, siginfo_t *, void *); + TaskList::iterator priorityEnd(TaskInfo::Priority p); + void run(TaskList::iterator f, TaskList::iterator l); + + struct NullTask : public TaskInfo + { + NullTask(); + ~NullTask(); + virtual void v_run();; + virtual char const * v_type() const; + virtual std::string v_info() const; + }; + TaskList tasks_; TaskList::iterator next_; + + NullTask normalPriorityEnd_; + NullTask highPriorityEnd_; + timer_t watchdogId_; + bool watchdogRunning_; unsigned watchdogMs_; + bool watchdogAbort_; std::string runningName_; # ifdef SENF_DEBUG std::string runningBacktrace_; # endif unsigned watchdogCount_; unsigned hangCount_; + bool yield_; friend void senf::scheduler::restart(); friend class singleton;