mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
4baaa8c3d8
commit
536fca7f7e
2 changed files with 13 additions and 0 deletions
|
@ -131,6 +131,13 @@ void qemu_coroutine_enter(Coroutine *co)
|
|||
}
|
||||
}
|
||||
|
||||
void qemu_coroutine_enter_if_inactive(Coroutine *co)
|
||||
{
|
||||
if (!qemu_coroutine_entered(co)) {
|
||||
qemu_coroutine_enter(co);
|
||||
}
|
||||
}
|
||||
|
||||
void coroutine_fn qemu_coroutine_yield(void)
|
||||
{
|
||||
Coroutine *self = qemu_coroutine_self();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue