EV_P_
is a macro which means "an ev loop as a parameter, plus a comma".
EV_A_
is a macro which means "an ev loop as an argument, plus a comma".
They are defined as
#define EV_P struct ev_loop *loop /* a loop as sole parameter in a declaration */
#define EV_P_ EV_P, /* a loop as first of multiple parameters */
#define EV_A loop /* a loop as sole argument to a function call */
#define EV_A_ EV_A, /* a loop as first of multiple arguments */
or as
# define EV_P void
# define EV_P_
# define EV_A
# define EV_A_
(Some whitespace was removed so it would fit better.)
This means
static void stdin_cb( EV_P_ ev_io *w, int revents ) {
puts( "stdin ready" );
ev_io_stop( EV_A_ w );
ev_break( EV_A_ EVBREAK_ALL );
}
is equivalent to
static void stdin_cb( struct ev_loop *loop, ev_io *w, int revents ) {
puts( "stdin ready" );
ev_io_stop( loop, w );
ev_break( loop, EVBREAK_ALL );
}
or
static void stdin_cb( ev_io *w, int revents ) {
puts( "stdin ready" );
ev_io_stop( w );
ev_break( EVBREAK_ALL );
}
Which set of #define
directives is used is configurable.
If EV_MULTIPLICITY
is set and nonzero, the first set is used. The first set allows multiple ev loops to be used in the same program. (Perhaps in different threads.)
If EV_MULTIPLICITY
is unset or zero, the second set is used. The second is more efficient since it uses global variables instead of passing a structure to every ev-related function. But the program can only have one event loop.