summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell2019-10-15 11:55:38 +0200
committerPeter Maydell2019-10-15 11:55:38 +0200
commit3779d1801166cc27b91f88366dd5bbae6b1c6dde (patch)
treeff205fb4a6f9318accca54c14e2516400391d430 /tests
parentMerge remote-tracking branch 'remotes/mcayland/tags/qemu-openbios-20191012' i... (diff)
parenttest-bdrv-drain: fix iothread_join() hang (diff)
downloadqemu-3779d1801166cc27b91f88366dd5bbae6b1c6dde.tar.gz
qemu-3779d1801166cc27b91f88366dd5bbae6b1c6dde.tar.xz
qemu-3779d1801166cc27b91f88366dd5bbae6b1c6dde.zip
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Pull request # gpg: Signature made Mon 14 Oct 2019 09:52:03 BST # gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full] # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full] # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: test-bdrv-drain: fix iothread_join() hang Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/iothread.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/iothread.c b/tests/iothread.c
index 777d9eea46..13c9fdcd8d 100644
--- a/tests/iothread.c
+++ b/tests/iothread.c
@@ -55,10 +55,16 @@ static void *iothread_run(void *opaque)
return NULL;
}
-void iothread_join(IOThread *iothread)
+static void iothread_stop_bh(void *opaque)
{
+ IOThread *iothread = opaque;
+
iothread->stopping = true;
- aio_notify(iothread->ctx);
+}
+
+void iothread_join(IOThread *iothread)
+{
+ aio_bh_schedule_oneshot(iothread->ctx, iothread_stop_bh, iothread);
qemu_thread_join(&iothread->thread);
qemu_cond_destroy(&iothread->init_done_cond);
qemu_mutex_destroy(&iothread->init_done_lock);