Skip to content

Instantly share code, notes, and snippets.

@mnunberg
Created July 26, 2012 20:25
Show Gist options
  • Save mnunberg/3184296 to your computer and use it in GitHub Desktop.
Save mnunberg/3184296 to your computer and use it in GitHub Desktop.
#define pp_ev_allow_revent(l, e, revt_) \
if ( ( (e)->events & revt_) != revt_ ) { \
ev_io_stop(l, (e)); \
ev_io_set( (e), (e)->fd, (e)->events | revt_); \
ev_io_start(l, (e)); \
}
#define pp_ev_ignore_revent(l, e, revt_) \
if ((e)->events & revt_) { \
ev_io_stop(l, (e)); \
ev_io_set( (e), (e)->fd, ( (e)->events) & (~revt_)); \
ev_io_start(l, (e)); \
}
#define pp_ev_run_with_cb(loop, conn, cb, revents) \
ev_io_init(&(conn->w), cb, conn->fd, revents); \
ev_io_start(loop, &(conn->w));
#define pp_ev_switch_cb(loop, conn, cb, revents) \
ev_io_stop(loop, &(conn->w)); \
pp_ev_run_with_cb(loop, conn, cb, revents);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment