coroutine: Introduce qemu_coroutine_enter_if_inactive()
commit536fca7f7ea4913f71df7f420953e97619be74e1
authorKevin Wolf <kwolf@redhat.com>
Mon, 7 Nov 2016 15:34:35 +0000 (7 16:34 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 9 Jan 2017 12:30:52 +0000 (9 13:30 +0100)
treea23646c39583a7a43ced78c5714b5103f5aa7fce
parent4baaa8c3d891b57036fd2a7c6a890737793fe3a0
coroutine: Introduce qemu_coroutine_enter_if_inactive()

In the context of asynchronous work, if we have a worker coroutine that
didn't yield, the parent coroutine cannot be reentered because it hasn't
yielded yet. In this case we don't even have to reenter the parent
because it will see that the work is already done and won't even yield.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
include/qemu/coroutine.h
util/qemu-coroutine.c