提交 8865852e 编写于 作者: F Fam Zheng

async: Introduce aio_co_enter

They start the coroutine on the specified context.
Signed-off-by: NFam Zheng <famz@redhat.com>
Acked-by: NStefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: NKevin Wolf <kwolf@redhat.com>
上级 ba9e75ce
......@@ -510,6 +510,15 @@ void aio_co_schedule(AioContext *ctx, struct Coroutine *co);
*/
void aio_co_wake(struct Coroutine *co);
/**
* aio_co_enter:
* @ctx: the context to run the coroutine
* @co: the coroutine to run
*
* Enter a coroutine in the specified AioContext.
*/
void aio_co_enter(AioContext *ctx, struct Coroutine *co);
/**
* Return the AioContext whose event loop runs in the current thread.
*
......
......@@ -453,6 +453,11 @@ void aio_co_wake(struct Coroutine *co)
smp_read_barrier_depends();
ctx = atomic_read(&co->ctx);
aio_co_enter(ctx, co);
}
void aio_co_enter(AioContext *ctx, struct Coroutine *co)
{
if (ctx != qemu_get_current_aio_context()) {
aio_co_schedule(ctx, co);
return;
......@@ -464,7 +469,7 @@ void aio_co_wake(struct Coroutine *co)
QSIMPLEQ_INSERT_TAIL(&self->co_queue_wakeup, co, co_queue_next);
} else {
aio_context_acquire(ctx);
qemu_coroutine_enter(co);
qemu_aio_coroutine_enter(ctx, co);
aio_context_release(ctx);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册