X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FFdManager.hh;h=ce34bfaa39e902b57bb76f7fd314695bfd6865b6;hb=532240d72e09e19e57fac9bb55c2560b9c9e5b97;hp=48452330483988de8faf15507913cdafd6913963;hpb=925317c7f45c32b01ab9292023db3f372b74bf0f;p=senf.git diff --git a/Scheduler/FdManager.hh b/Scheduler/FdManager.hh index 4845233..ce34bfa 100644 --- a/Scheduler/FdManager.hh +++ b/Scheduler/FdManager.hh @@ -23,8 +23,8 @@ /** \file \brief FdManager public header */ -#ifndef HH_FdManager_ -#define HH_FdManager_ 1 +#ifndef HH_SENF_Scheduler_FdManager_ +#define HH_SENF_Scheduler_FdManager_ 1 // Custom includes #include "Poller.hh" @@ -35,34 +35,16 @@ ///////////////////////////////hh.p//////////////////////////////////////// namespace senf { - - class Scheduler; - namespace scheduler { - /** \brief Manage file descriptor event processing - - The FdManager is the internal class which manages all events (all events need to somehow be - made accessible via a file descriptor). File descriptors are added or removed from the - FdManager which then allows waiting until an event occurs on one of the descriptors. + void restart(); - Registered events must be derived from FdManager::Event. The FdManager does \e not manage - the event classes, it just manages pointers to externally owned events (the events are owned - by the respective dispatchers). +namespace detail { - When an event is posted, it's \c signal() member is called. However, this call will \e not - execute the user callback registered for the event, it will just mark the relevant tasks as - runnable. - - \implementation - */ class FdManager : public singleton { public: - /////////////////////////////////////////////////////////////////////////// - // Types - ///< Event baseclass struct Event { virtual ~Event(); @@ -74,41 +56,21 @@ namespace scheduler { EV_HUP = Poller::EV_HUP, EV_ERR = Poller::EV_ERR }; - /////////////////////////////////////////////////////////////////////////// - ///\name Structors and default members - ///@{ - using singleton::instance; using singleton::alive; - ///@} - /////////////////////////////////////////////////////////////////////////// - - bool set(int fd, int events, Event * entry); ///< Set file descriptor event mask - /**< This sets the event mask for \a fd to \a events which - is a combination of values from the \c Events enum. If - \a fd is already registered, the registration is - changed to conform to the parameters passed, otherwise - a new registration is added. - \param[in] fd file descriptor - \param[in] events events to register for - \param[in] entry event to signal - \returns \c true, if \a fd supports polling, \c false - otherwise */ - void remove(int fd); ///< Remove \a fd from the manager - + bool set(int fd, int events, Event * entry); + void remove(int fd); void timeout(int t); ///< Set event timeout /**< proceseOnce() will wait for max \a t milliseconds for an event to occur. If set to -1, processOnce() will wait forever. */ - int timeout() const; ///< Get timeout in milliseconds - + int timeout() const; void processOnce(); ///< Wait for events /**< This call waits until at least one event is posted but no longer than the current timeout(). */ - ClockService::clock_type eventTime() const; ///< Time of last event - + protected: private: @@ -117,11 +79,11 @@ namespace scheduler { Poller poller_; senf::ClockService::clock_type eventTime_; + friend void senf::scheduler::restart(); friend class singleton; - friend class senf::Scheduler; }; -}} +}}} ///////////////////////////////hh.e//////////////////////////////////////// #include "FdManager.cci"