* Thread timer management class.
*/
-#include <set>
+#include <vector>
#include <boost/noncopyable.hpp>
/**
* A runloop is a loop with scheduled timers.
*/
-class runloop
+class runloop : public boost::noncopyable
{
public:
* Construct a runloop.
*/
runloop() :
- stop_(false),
- thread_id_(0) {}
+ stop_(false)
+ {
+#if ENABLE_THREADS
+ thread_id_ = 0;
+#endif
+ }
/**
* Deconstruct the runloop.
static runloop* current();
-private:
+ void add_timer(timer& timer);
+ void remove_timer(timer& timer);
- friend class timer;
-
- void add_timer(timer* timer);
- void remove_timer(timer* timer);
+private:
bool stop_;
int code_;
- typedef std::set<timer*> timer_table;
+ typedef std::vector<timer*> timer_table;
timer_table timers_;
timer_table::iterator timers_it_;