-
-static void
-ocb (struct ev_timer *w, int revents)
-{
- //fprintf (stderr, "timer %f,%f (%x) (%f) d%p\n", w->at, w->repeat, revents, w->at - ev_time (), w->data);
- ev_timer_stop (w);
- ev_timer_start (w);
-}
-
-static void
-scb (struct ev_signal *w, int revents)
-{
- fprintf (stderr, "signal %x,%d\n", revents, w->signum);
- ev_io_stop (&wio);
- ev_io_start (&wio);
-}
-
-static void
-gcb (struct ev_signal *w, int revents)
-{
- fprintf (stderr, "generic %x\n", revents);
-
-}
-
-int main (void)
-{
- ev_init (0);
-
- ev_io_init (&wio, sin_cb, 0, EV_READ);
- ev_io_start (&wio);
-
- struct ev_timer t[10000];
-
-#if 0
- int i;
- for (i = 0; i < 10000; ++i)
- {
- struct ev_timer *w = t + i;
- ev_watcher_init (w, ocb, i);
- ev_timer_init_abs (w, ocb, drand48 (), 0.99775533);
- ev_timer_start (w);
- if (drand48 () < 0.5)
- ev_timer_stop (w);
- }
-#endif
-
- struct ev_timer t1;
- ev_timer_init (&t1, ocb, 5, 10);
- ev_timer_start (&t1);
-
- struct ev_signal sig;
- ev_signal_init (&sig, scb, SIGQUIT);
- ev_signal_start (&sig);
-
- struct ev_check cw;
- ev_check_init (&cw, gcb);
- ev_check_start (&cw);
-
- struct ev_idle iw;
- ev_idle_init (&iw, gcb);
- ev_idle_start (&iw);
-
- ev_loop (0);
-
- return 0;
-}
-