X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FTimerEvent.ih;h=fdb62f2888c3764df454803183b7c2742f9e05ff;hb=b89e3166f7680755683dccee5e48cb3a820185c0;hp=7062de2be439b6afb8d415d52782c7b0d90dfb4e;hpb=03516e8371a90f908ce54dedb3c874eec7dd08ff;p=senf.git diff --git a/Scheduler/TimerEvent.ih b/Scheduler/TimerEvent.ih index 7062de2..fdb62f2 100644 --- a/Scheduler/TimerEvent.ih +++ b/Scheduler/TimerEvent.ih @@ -23,19 +23,21 @@ /** \file \brief TimerDispatcher internal header */ -#ifndef IH_TimerDispatcher_ -#define IH_TimerDispatcher_ 1 +#ifndef IH_SENF_Scheduler_TimerEvent_ +#define IH_SENF_Scheduler_TimerEvent_ 1 // Custom includes +#include #include "../boost/intrusive/iset.hpp" +#include "TimerSource.hh" ///////////////////////////////ih.p//////////////////////////////////////// namespace senf { +namespace scheduler { - class Scheduler; + void restart(); -namespace scheduler { namespace detail { struct TimerSetCompare { @@ -44,8 +46,7 @@ namespace detail { }; class TimerDispatcher - : public FdManager::Event, - public singleton + : public singleton { SENF_LOG_CLASS_AREA(); @@ -56,33 +57,32 @@ namespace detail { void add(TimerEvent & event); void remove(TimerEvent & event); - void unblockSignals(); - void blockSignals(); - + void enable(); + void disable(); + + void prepareRun(); + void reschedule(); + bool empty() const; + void timerSource(std::auto_ptr timerSource); + TimerSource * timerSource(); + protected: private: TimerDispatcher(); ~TimerDispatcher(); - virtual void signal(int events); - static void sigHandler(int signal, ::siginfo_t * siginfo, void *); - void reschedule(); - typedef boost::intrusive::imultiset< TimerSetBase::value_traits, TimerSetCompare, false > TimerSet; TimerSet timers_; - int timerPipe_[2]; - sigset_t sigSet_; - bool blocked_; - timer_t timerId_; + boost::scoped_ptr source_; - friend class senf::Scheduler; + friend void senf::scheduler::restart(); friend class singleton; };