]> Dogcows Code - chaz/yoink/blobdiff - src/moof/runloop.hh
fixed documentation about where to find licenses
[chaz/yoink] / src / moof / runloop.hh
index f70abdef3891bf3b687633f71380099c677790cf..43d4ea2e580fc2e2f5982797401a3a1e6caae20a 100644 (file)
@@ -1,36 +1,32 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_RUNLOOP_HH_
 #define _MOOF_RUNLOOP_HH_
 
-/**
- * \file runloop.hh
- * Thread timer management class.
- */
-
 #include <vector>
 
 #include <boost/noncopyable.hpp>
 
-#include <moof/backend.hh>
 #include <moof/thread.hh>
 
 
+/**
+ * \file runloop.hh
+ * Thread timer management class.
+ */
+
 namespace moof {
 
 
 // forward declarations
 class timer;
-       
 
 /**
  * A runloop is a loop with scheduled timers.
@@ -51,10 +47,10 @@ public:
        }
 
        /**
-        * Deconstruct the runloop.
+        * Do one iteration of the runloop.
+        * \return The number of tasks which were given time.
         */
-       ~runloop();
-
+       int run_once();
 
        /**
         * Start running the runloop.
@@ -68,22 +64,18 @@ public:
         */
        void stop(int code = 0);
 
-
-       /** Get the runloop of the current thread.
-        * \return The current runloop or 0 if none is running in the current
-        * thread.
-        */
-       static runloop* current();
-
+       bool is_running() const
+       {
+               return !stop_;
+       }
 
        void add_timer(timer& timer);
        void remove_timer(timer& timer);
 
-
 private:
 
        bool            stop_;
-       int                     code_;
+       int             code_;
 
        typedef std::vector<timer*> timer_table;
        timer_table     timers_;
@@ -93,9 +85,6 @@ private:
        MOOF_DECLARE_MUTEX(timers_mutex_);
        uint32_t        thread_id_;
 #endif
-
-
-       backend         backend_;
 };
 
 
This page took 0.018778 seconds and 4 git commands to generate.