Esempio n. 1
0
static void
ev_item_destroy(ev_item_t **ev)
{
    if (*ev != NULL) {
        if ((*ev)->ty == EV_TYPE_IO) {
#ifdef TRACE_VERBOSE
            CTRACE(FRED("destroying ev_io %d/%s"),
                   (*ev)->ev.io.fd,
                   EV_STR((*ev)->ev.io.events));
#endif
            ev_io_stop(the_loop, &(*ev)->ev.io);
        } else if ((*ev)->ty == EV_TYPE_STAT) {
#ifdef TRACE_VERBOSE
            CTRACE(FRED("destroying ev_stat %s/%d"),
                   (*ev)->ev.stat.path, (*ev)->ev.stat.wd);
#endif
            ev_stat_stop(the_loop, &(*ev)->ev.stat);
            BYTES_DECREF(&(*ev)->stat_path);
        } else {
            FAIL("ev_item_destroy");
        }
        free(*ev);
        *ev = NULL;
    }
}
Esempio n. 2
0
/**
 * Async events
 *
 */
void
poller_clear_event(mrkthr_ctx_t *ctx)
{
    if (ctx->pdata.ev != NULL) {
        ev_item_t *ev;

        ev = ctx->pdata.ev;
        if (ev->ty == EV_TYPE_IO) {
#ifdef TRACE_VERBOSE
        CTRACE(FRED("clearing ev_io %d/%s"),
               ev->ev.io.fd,
               EV_STR(ev->ev.io.events));
#endif
            ev_io_stop(the_loop, &ev->ev.io);
        } else if (ev->ty == EV_TYPE_STAT) {
#ifdef TRACE_VERBOSE
        CTRACE(FRED("clearing ev_stat %s/%d"),
               ev->ev.stat.path,
               ev->ev.stat.wd);
#endif
            ev_stat_stop(the_loop, &ev->ev.stat);
        } else {
            FAIL("poller_clear_event");
        }
    }
}
Esempio n. 3
0
static void
clear_event_stat(ev_item_t *ev)
{
#ifdef TRACE_VERBOSE
    CTRACE(FRED("clearing ev_stat %s/%d"),
           ev->ev.stat.path, ev->ev.stat.wd);
#endif
    ev_stat_stop(the_loop, &ev->ev.stat);
}
Esempio n. 4
0
static void
ev_stat_cb(UNUSED EV_P_ ev_stat *w, UNUSED int revents)
{
    mrkthr_ctx_t *ctx;
    ev_item_t *ev;

    ctx = w->data;

    if (ctx == NULL) {
        CTRACE("no thread for stat path %s using default [discard]...", w->path);
        ev_stat_stop(the_loop, w);

    } else {
        ev = ctx->pdata.ev;

        assert(ev != NULL);
        assert(&ev->ev.stat == w);

        ctx->pdata.ev = NULL;

        if (ctx->co.f == NULL) {
            CTRACE("co for stat path %s is NULL, discarding ...", w->path);
            clear_event_stat(ev);

        } else {
            /*
             * XXX
             */

            clear_event_stat(ev);

            if (poller_resume(ctx) != 0) {
#ifdef TRACE_VERBOSE
                CTRACE("Could not resume co %d "
                      "for stat path %s, discarding ...",
                      ctx->co.id, w->path);
#endif
            }
        }
    }
}
Esempio n. 5
0
static void stat_stop (void *impl, flux_watcher_t *w)
{
    assert (w->signature == STAT_SIG);
    ev_stat_stop (w->r->loop, (ev_stat *)impl);
}