+ void loop (int flags = 0)
+ {
+ ev_loop (EV_AX_ flags);
+ }
+
+ void unloop (how_t how = ONE) throw ()
+ {
+ ev_unloop (EV_AX_ how);
+ }
+
+ void post_fork () throw ()
+ {
+#if EV_MULTIPLICITY
+ ev_loop_fork (EV_AX);
+#else
+ ev_default_fork ();
+#endif
+ }
+
+ unsigned int count () const throw ()
+ {
+ return ev_loop_count (EV_AX);
+ }
+
+ unsigned int backend () const throw ()
+ {
+ return ev_backend (EV_AX);
+ }
+
+ tstamp now () const throw ()
+ {
+ return ev_now (EV_AX);
+ }
+
+ void ref () throw ()
+ {
+ ev_ref (EV_AX);
+ }
+
+ void unref () throw ()
+ {
+ ev_unref (EV_AX);
+ }
+
+ void set_io_collect_interval (tstamp interval) throw ()
+ {
+ ev_set_io_collect_interval (EV_AX_ interval);
+ }
+
+ void set_timeout_collect_interval (tstamp interval) throw ()
+ {
+ ev_set_timeout_collect_interval (EV_AX_ interval);
+ }
+
+ // function callback
+ void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void* arg = 0) throw ()
+ {
+ ev_once (EV_AX_ fd, events, timeout, cb, arg);
+ }
+
+ // method callback
+ template<class K, void (K::*method)(int)>
+ void once (int fd, int events, tstamp timeout, K *object) throw ()
+ {
+ once (fd, events, timeout, method_thunk<K, method>, object);
+ }
+
+ template<class K, void (K::*method)(int)>
+ static void method_thunk (int revents, void* arg)
+ {
+ K *obj = static_cast<K *>(arg);
+ (obj->*method) (revents);
+ }
+
+ // const method callback
+ template<class K, void (K::*method)(int) const>
+ void once (int fd, int events, tstamp timeout, const K *object) throw ()
+ {
+ once (fd, events, timeout, const_method_thunk<K, method>, object);
+ }
+
+ template<class K, void (K::*method)(int) const>
+ static void const_method_thunk (int revents, void* arg)
+ {
+ K *obj = static_cast<K *>(arg);
+ (obj->*method) (revents);
+ }
+
+ // simple method callback
+ template<class K, void (K::*method)()>
+ void once (int fd, int events, tstamp timeout, K *object) throw ()
+ {
+ once (fd, events, timeout, method_noargs_thunk<K, method>, object);
+ }
+
+ template<class K, void (K::*method)()>
+ static void method_noargs_thunk (int revents, void* arg)
+ {
+ K *obj = static_cast<K *>(arg);
+ (obj->*method) ();
+ }
+
+ // simpler function callback
+ template<void (*cb)(int)>
+ void once (int fd, int events, tstamp timeout) throw ()
+ {
+ once (fd, events, timeout, simpler_func_thunk<cb>);
+ }
+
+ template<void (*cb)(int)>
+ static void simpler_func_thunk (int revents, void* arg)
+ {
+ (*cb) (revents);
+ }
+
+ // simplest function callback
+ template<void (*cb)()>
+ void once (int fd, int events, tstamp timeout) throw ()
+ {
+ once (fd, events, timeout, simplest_func_thunk<cb>);
+ }
+
+ template<void (*cb)()>
+ static void simplest_func_thunk (int revents, void* arg)
+ {
+ (*cb) ();
+ }
+
+ void feed_fd_event (int fd, int revents) throw ()
+ {
+ ev_feed_fd_event (EV_AX_ fd, revents);
+ }
+
+ void feed_signal_event (int signum) throw ()
+ {
+ ev_feed_signal_event (EV_AX_ signum);
+ }
+
+#if EV_MULTIPLICITY
+ struct ev_loop* EV_AX;
+#endif
+
+ };
+
+#if EV_MULTIPLICITY
+ struct dynamic_loop: loop_ref