diff options
-rw-r--r-- | ev.c | 17 | ||||
-rw-r--r-- | ev.h | 10 |
2 files changed, 23 insertions, 4 deletions
@@ -2188,7 +2188,7 @@ ev_embed_sweep (EV_P_ ev_embed *w) } 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)); @@ -2198,6 +2198,14 @@ embed_cb (EV_P_ ev_io *io, int revents) 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) { @@ -2207,12 +2215,16 @@ 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); } @@ -2224,6 +2236,7 @@ ev_embed_stop (EV_P_ ev_embed *w) return; ev_io_stop (EV_A_ &w->io); + ev_prepare_stop (EV_A_ &w->prepare); ev_stop (EV_A_ (W)w); } @@ -120,7 +120,7 @@ struct ev_loop; # define EV_PROTOTYPES 1 #endif -#define EV_VERSION_MAJOR 1 +#define EV_VERSION_MAJOR 2 #define EV_VERSION_MINOR 0 #ifndef EV_CB_DECLARE @@ -285,8 +285,14 @@ typedef struct ev_embed { 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 |