Scheduler: Remove obsolete 'Scheduler' class
[senf.git] / Scheduler / FdManager.hh
index ecc7f98..f432032 100644 (file)
@@ -28,6 +28,8 @@
 
 // Custom includes
 #include "Poller.hh"
+#include "ClockService.hh"
+#include "../Utils/singleton.hh"
 
 //#include "FdManager.mpp"
 ///////////////////////////////hh.p////////////////////////////////////////
 namespace senf {
 namespace scheduler {
 
-    /** \brief
-      */
+    void restart();
+
+namespace detail {
+
     class FdManager
+        : public singleton<FdManager>
     {
     public:
-        ///////////////////////////////////////////////////////////////////////////
-        // Types
-
+        ///< Event baseclass
         struct Event {
             virtual ~Event();
-            virtual void signal(int events) = 0;
+            virtual void signal(int events) = 0; ///< Called when the given event is posted
         };
 
         enum Events { 
@@ -53,28 +56,34 @@ namespace scheduler {
             EV_HUP = Poller<Event>::EV_HUP, EV_ERR = Poller<Event>::EV_ERR 
         };
 
-        ///////////////////////////////////////////////////////////////////////////
-        ///\name Structors and default members
-        ///@{
-
-        ///@}
-        ///////////////////////////////////////////////////////////////////////////
+        using singleton<FdManager>::instance;
+        using singleton<FdManager>::alive;
 
-        void set(int fd, int events, Event * entry);
+        bool set(int fd, int events, Event * entry);
         void remove(int fd);
-
-        void timeout(int t);
+        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;
-
-        void processOnce();
+        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:
+        FdManager();
+
         Poller<Event> poller_;
+        senf::ClockService::clock_type eventTime_;
+
+        friend void senf::scheduler::restart();
+        friend class singleton<FdManager>;
     };
 
-}}
+}}}
 
 ///////////////////////////////hh.e////////////////////////////////////////
 #include "FdManager.cci"