mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
coroutine: Assert that no locks are held on termination
A coroutine that takes a lock must also release it again. If the coroutine terminates without having released all its locks, it's buggy and we'll probably run into a deadlock sooner or later. Make sure that we don't get such cases. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@ -122,6 +122,7 @@ void qemu_coroutine_enter(Coroutine *co)
|
||||
case COROUTINE_YIELD:
|
||||
return;
|
||||
case COROUTINE_TERMINATE:
|
||||
assert(!co->locks_held);
|
||||
trace_qemu_coroutine_terminate(co);
|
||||
coroutine_delete(co);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user