Example #1
0
int coroutine_fn pr_manager_execute(PRManager *pr_mgr, AioContext *ctx, int fd,
                                    struct sg_io_hdr *hdr)
{
    ThreadPool *pool = aio_get_thread_pool(ctx);
    PRManagerData data = {
        .pr_mgr = pr_mgr,
        .fd     = fd,
        .hdr    = hdr,
    };

    trace_pr_manager_execute(fd, hdr->cmdp[0], hdr->cmdp[1]);

    /* The matching object_unref is in pr_manager_worker.  */
    object_ref(OBJECT(pr_mgr));
    return thread_pool_submit_co(pool, pr_manager_worker, &data);
}
Example #2
0
BlockAIOCB *pr_manager_execute(PRManager *pr_mgr,
                               AioContext *ctx, int fd,
                               struct sg_io_hdr *hdr,
                               BlockCompletionFunc *complete,
                               void *opaque)
{
    PRManagerData *data = g_new(PRManagerData, 1);
    ThreadPool *pool = aio_get_thread_pool(ctx);

    trace_pr_manager_execute(fd, hdr->cmdp[0], hdr->cmdp[1], opaque);
    data->pr_mgr = pr_mgr;
    data->fd = fd;
    data->hdr = hdr;

    /* The matching object_unref is in pr_manager_worker.  */
    object_ref(OBJECT(pr_mgr));
    return thread_pool_submit_aio(pool, pr_manager_worker,
                                  data, complete, opaque);
}