}
static void
-embed_cb (EV_P_ ev_io *io, int revents)
+embed_io_cb (EV_P_ ev_io *io, int revents)
{
ev_embed *w = (ev_embed *)(((char *)io) - offsetof (ev_embed, io));
ev_embed_sweep (loop, w);
}
+static void
+embed_prepare_cb (EV_P_ ev_prepare *prepare, int revents)
+{
+ ev_embed *w = (ev_embed *)(((char *)prepare) - offsetof (ev_embed, prepare));
+
+ fd_reify (w->other);
+}
+
void
ev_embed_start (EV_P_ ev_embed *w)
{
{
struct ev_loop *loop = w->other;
assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
- ev_io_init (&w->io, embed_cb, backend_fd, EV_READ);
+ ev_io_init (&w->io, embed_io_cb, backend_fd, EV_READ);
}
ev_set_priority (&w->io, ev_priority (w));
ev_io_start (EV_A_ &w->io);
+ ev_prepare_init (&w->prepare, embed_prepare_cb);
+ ev_set_priority (&w->prepare, EV_MINPRI);
+ ev_prepare_start (EV_A_ &w->prepare);
+
ev_start (EV_A_ (W)w, 1);
}
return;
ev_io_stop (EV_A_ &w->io);
+ ev_prepare_stop (EV_A_ &w->prepare);
ev_stop (EV_A_ (W)w);
}
# define EV_PROTOTYPES 1
#endif
-#define EV_VERSION_MAJOR 1
+#define EV_VERSION_MAJOR 2
#define EV_VERSION_MINOR 0
#ifndef EV_CB_DECLARE
{
EV_WATCHER (ev_embed)
- ev_io io; /* private */
struct ev_loop *other; /* ro */
+ ev_io io; /* private */
+ ev_prepare prepare; /* private */
+ ev_check check; /* unused */
+ ev_timer timer; /* unused */
+ ev_periodic periodic; /* unused */
+ ev_idle idle; /* unused */
+ ev_fork fork; /* unused */
} ev_embed;
#endif