ev.h
int ev_fire_event(ev_context *ctx, int fd, int mask,
                  void (*callback)(ev_context *, void *), void *data) {
    int ret = 0;
    ev_add_monitored(ctx, fd, mask, callback, data);
    ret = ev_api_fire_event(ctx, fd, mask);
    if (ret < 0) return EV_ERR;
    if (mask & EV_EVENTFD) {
#ifdef __linux__
        ret = eventfd_write(fd, 1);
#else
        ret = write(fd, &(unsigned long){1}, sizeof(unsigned long));
#endif // __linux__
        if (ret < 0) return EV_ERR;
    }
    return EV_OK;
}
/*
 * Register a new event for the next loop cycle to a FD. Equal to ev_watch_fd
 * but allow to carry an event object for the next cycle.
 *
 * Set a callback and an argument to be passed to for the next loop cycle,
 * associating it to a file descriptor, ultimately resulting in an event to be
 * dispatched and processed.
 *
 * Behave like ev_register_event but it's meant to be called when the file
 * descriptor is already registered in the loop.
 *
 * - mask: bitmask used to describe what type of event we're going to fire
 * - callback:  is a function pointer to the routine we want to execute
 * - data:  an opaque pointer to the arguments for the callback.
 */
Register a new event for the next loop cycle to a FD. Equal to ev_watch_fd
but allow to carry an event object for the next cycle.

Set a callback and an argument to be passed to for the next loop cycle,
associating it to a file descriptor, ultimately resulting in an event to be
dispatched and processed.

Behave like ev_register_event but it's meant to be called when the file
descriptor is already registered in the loop.

- mask: bitmask used to describe what type of event we're going to fire
- callback:  is a function pointer to the routine we want to execute
- data:  an opaque pointer to the arguments for the callback.
Register a new event for the next loop cycle to a FD . Equal to ev_watch_fd but allow to carry an event object for the next cycle . Set a callback and an argument to be passed to for the next loop cycle associating it to a file descriptor ultimately resulting in an event to be dispatched and processed . Behave like ev_register_event but it ' s meant to be called when the file descriptor is already registered in the loop . - mask : bitmask used to describe what type of event we ' re going to fire - callback : is a function pointer to the routine we want to execute - data : an opaque pointer to the arguments for the callback .
int ev_fire_event(ev_context *ctx, int fd, int mask,
                  void (*callback)(ev_context *, void *), void *data) {
    int ret = 0;
    ev_add_monitored(ctx, fd, mask, callback, data);
    ret = ev_api_fire_event(ctx, fd, mask);
    if (ret < 0) return EV_ERR;
    if (mask & EV_EVENTFD) {
#ifdef __linux__
        ret = eventfd_write(fd, 1);
#else
        ret = write(fd, &(unsigned long){1}, sizeof(unsigned long));
#endif 
        if (ret < 0) return EV_ERR;
    }
    return EV_OK;
}
int ev_fire_event ( ev_context * ctx , int fd , int mask , void ( * callback ) ( ev_context * , void * ) , void * data ) { int ret = 0 ; ev_add_monitored ( ctx , fd , mask , callback , data ) ; ret = ev_api_fire_event ( ctx , fd , mask ) ; if ( ret < 0 ) return EV_ERR ; if ( mask & EV_EVENTFD ) { #ifdef __linux__ ret = eventfd_write ( fd , 1 ) ; #else ret = write ( fd , & ( unsigned long ) { 1 } , sizeof ( unsigned long ) ) ; #endif if ( ret < 0 ) return EV_ERR ; } return EV_OK ; }
Register a new event for the next loop cycle to a FD.
Register a new event for the next loop cycle to a FD .
// __linux__