ev.h
int ev_run(ev_context *ctx) {
    int n = 0, events = 0;
    /*
     * Start an infinite loop, can be stopped only by scheduling an ev_stop
     * callback or if an error on the underlying backend occur
     */
    ctx->is_running = 1;
    while (!ctx->stop) {
        /*
         * blocks polling for events, -1 means forever. Returns only in case of
         * valid events ready to be processed or errors
         */
        n = ev_poll(ctx, EVENTLOOP_TIMEOUT);
        if (n < 0) {
            /* Signals to all threads. Ignore it for now */
            if (errno == EINTR)
                continue;
            /* Error occured, break the loop */
            break;
        }
        for (int i = 0; i < n; ++i) {
            events = ev_get_event_type(ctx, i);
            ctx->fired_events += ev_process_event(ctx, i, events);
        }
    }
    return n;
}
/*
 * Blocks forever in a loop polling for events with ev_poll calls. At every
 * cycle executes callbacks registered with each event
 */
Blocks forever in a loop polling for events with ev_poll calls. At every
cycle executes callbacks registered with each event
Blocks forever in a loop polling for events with ev_poll calls . At every cycle executes callbacks registered with each event
int ev_run(ev_context *ctx) {
    int n = 0, events = 0;
    ctx->is_running = 1;
    while (!ctx->stop) {
        n = ev_poll(ctx, EVENTLOOP_TIMEOUT);
        if (n < 0) {
            if (errno == EINTR)
                continue;
            break;
        }
        for (int i = 0; i < n; ++i) {
            events = ev_get_event_type(ctx, i);
            ctx->fired_events += ev_process_event(ctx, i, events);
        }
    }
    return n;
}
int ev_run ( ev_context * ctx ) { int n = 0 , events = 0 ; ctx -> is_running = 1 ; while ( ! ctx -> stop ) { n = ev_poll ( ctx , EVENTLOOP_TIMEOUT ) ; if ( n < 0 ) { if ( errno == EINTR ) continue ; break ; } for ( int i = 0 ; i < n ; ++ i ) { events = ev_get_event_type ( ctx , i ) ; ctx -> fired_events += ev_process_event ( ctx , i , events ) ; } } return n ; }
Blocks forever in a loop polling for events with ev_poll calls.
Blocks forever in a loop polling for events with ev_poll calls .
/*
     * Start an infinite loop, can be stopped only by scheduling an ev_stop
     * callback or if an error on the underlying backend occur
     */ /*
         * blocks polling for events, -1 means forever. Returns only in case of
         * valid events ready to be processed or errors
         */ /* Signals to all threads. Ignore it for now */ /* Error occured, break the loop */