aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-coroutine.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-08-11 17:51:59 +0200
committerKevin Wolf <kwolf@redhat.com>2016-09-05 19:06:48 +0200
commit1b7f01d966f97b7820f3cdd471461cf0799a93cc (patch)
treeaaf94f449ee10f7eb018b5f9987e6f1205036c68 /util/qemu-coroutine.c
parent0e438cdc932a785de72166af4641aafa103a6670 (diff)
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>
Diffstat (limited to 'util/qemu-coroutine.c')
-rw-r--r--util/qemu-coroutine.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
index 89f21a9cec..3cbf225487 100644
--- a/util/qemu-coroutine.c
+++ b/util/qemu-coroutine.c
@@ -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;