Example #1
0
int event_notifier_set_handler(EventNotifier *e,
                               bool is_external,
                               EventNotifierHandler *handler)
{
    aio_set_fd_handler(iohandler_get_aio_context(), e->rfd, is_external,
                       (IOHandler *)handler, NULL, e);
    return 0;
}
Example #2
0
static void qio_channel_set_aio_fd_handlers(QIOChannel *ioc)
{
    IOHandler *rd_handler = NULL, *wr_handler = NULL;
    AioContext *ctx;

    if (ioc->read_coroutine) {
        rd_handler = qio_channel_restart_read;
    }
    if (ioc->write_coroutine) {
        wr_handler = qio_channel_restart_write;
    }

    ctx = ioc->ctx ? ioc->ctx : iohandler_get_aio_context();
    qio_channel_set_aio_fd_handler(ioc, ctx, rd_handler, wr_handler, ioc);
}