Exemplo n.º 1
0
static void
qlooper_handle_io_bh(void* opaque)
{
    QLooper*  looper = opaque;
    QLoopIo*  io;

    while ((io = looper->io_pending) != NULL) {
        unsigned ready;
        
        looper->io_pending = io->pendingNext;
        io->pendingNext    = NULL;
        ready     = io->ready;
        io->ready = 0;
        io->user_callback(io->user_opaque, io->fd, ready);
    }
}
Exemplo n.º 2
0
/* This function is called by the main event loop when pending i/o
 * events were registered with qlooper_addPendingIo(). It will parse
 * the list of pending QLoopIo and call the user callback with the
 * appropriate flags.
 */
static void
qlooper_handle_io_bh(void* opaque)
{
    QLooper*  looper = opaque;
    QLoopIo*  io;

    while ((io = looper->io_pending) != NULL) {
        unsigned ready;
        /* extract from list */
        looper->io_pending = io->pendingNext;
        io->pendingNext    = NULL;
        /* call the user callback, clear io->ready before to
         * indicate that the item is not on the pending list
         * anymore.
         */
        ready     = io->ready;
        io->ready = 0;
        io->user_callback(io->user_opaque, io->fd, ready);
    }
}