mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 14:23:53 -06:00
coroutine-lock: introduce qemu_co_queue_enter_all
Because qemu_co_queue_restart_all does not release the lock, it should be used only in coroutine context. Introduce a new function that, like qemu_co_enter_next, does release the lock, and use it whenever qemu_co_queue_restart_all was used outside coroutine context. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20220427130830.150180-3-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
248af9e80a
commit
d6ee15adec
3 changed files with 21 additions and 1 deletions
|
@ -108,6 +108,13 @@ bool coroutine_fn qemu_co_queue_next(CoQueue *queue)
|
|||
return qemu_co_enter_next_impl(queue, NULL);
|
||||
}
|
||||
|
||||
void qemu_co_enter_all_impl(CoQueue *queue, QemuLockable *lock)
|
||||
{
|
||||
while (qemu_co_enter_next_impl(queue, lock)) {
|
||||
/* just loop */
|
||||
}
|
||||
}
|
||||
|
||||
bool qemu_co_queue_empty(CoQueue *queue)
|
||||
{
|
||||
return QSIMPLEQ_FIRST(&queue->entries) == NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue