Example #1
0
static void
qloopio_free(void* impl)
{
    QLoopIo* io = impl;
    if (io->ready)
        qloopio_removePending(io);

    
    qlooper_delIo(io->looper, io);

    
    qemu_set_fd_handler(io->fd, NULL, NULL, NULL);
    io->fd = -1;
    qemu_free(io);
}
static void
qloopio_free(void* impl)
{
    QLoopIo* io = impl;
    if (io->ready)
        qloopio_removePending(io);

    /* remove from global list */
    qlooper_delIo(io->looper, io);

    /* make QEMU forget about this fd */
    qemu_set_fd_handler(io->fd, NULL, NULL, NULL);
    io->fd = -1;
    qemu_free(io);
}
Example #3
0
static void
qloopio_modify(QLoopIo* io, unsigned wanted)
{
    
    if (wanted == io->wanted)
        return;

    if (io->ready && (io->ready & wanted) == 0) {
        qloopio_removePending(io);
    }

    
    IOHandler* fd_read  = (wanted & LOOP_IO_READ)  ? qloopio_handleRead  : NULL;
    IOHandler* fd_write = (wanted & LOOP_IO_WRITE) ? qloopio_handleWrite : NULL;
    qemu_set_fd_handler(io->fd, fd_read, fd_write, io);
    io->wanted = wanted;
}
static void
qloopio_modify(QLoopIo* io, unsigned wanted)
{
    /* no change, don't bother */
    if (wanted == io->wanted)
        return;

    /* if we're pending, but the new mask doesn't care about
     * out state, remove from pending list */
    if (io->ready && (io->ready & wanted) == 0) {
        qloopio_removePending(io);
    }

    /* recompute read/write handlers for QEMU */
    IOHandler* fd_read  = (wanted & LOOP_IO_READ)  ? qloopio_handleRead  : NULL;
    IOHandler* fd_write = (wanted & LOOP_IO_WRITE) ? qloopio_handleWrite : NULL;
    qemu_set_fd_handler(io->fd, fd_read, fd_write, io);
    io->wanted = wanted;
}