From 1b7f01d966f97b7820f3cdd471461cf0799a93cc Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 11 Aug 2016 17:51:59 +0200 Subject: 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 Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi --- util/qemu-coroutine.c | 1 + 1 file changed, 1 insertion(+) (limited to 'util/qemu-coroutine.c') 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; -- cgit v1.2.1