qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/3] virtio-9p-coth: add release function and fix in


From: Greg Kurz
Subject: [Qemu-devel] [PATCH 1/3] virtio-9p-coth: add release function and fix init error path
Date: Mon, 05 Oct 2015 11:07:16 +0200
User-agent: StGit/0.17.1-dirty

This is preliminary work to support hotplug/unplug of virtio-9p-device.

Signed-off-by: Greg Kurz <address@hidden>
---
 hw/9pfs/virtio-9p-coth.c |   13 +++++++++----
 hw/9pfs/virtio-9p-coth.h |    1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/hw/9pfs/virtio-9p-coth.c b/hw/9pfs/virtio-9p-coth.c
index 8185c533c013..a4392586c9a2 100644
--- a/hw/9pfs/virtio-9p-coth.c
+++ b/hw/9pfs/virtio-9p-coth.c
@@ -66,10 +66,7 @@ int v9fs_init_worker_threads(void)
     }
     p->completed = g_async_queue_new();
     if (!p->completed) {
-        /*
-         * We are going to terminate.
-         * So don't worry about cleanup
-         */
+        g_thread_pool_free(p->pool, true, true);
         ret = -1;
         goto err_out;
     }
@@ -80,3 +77,11 @@ err_out:
     pthread_sigmask(SIG_SETMASK, &oldset, NULL);
     return ret;
 }
+
+int v9fs_release_worker_threads(void)
+{
+        V9fsThPool *p = &v9fs_pool;
+
+        g_thread_pool_free(p->pool, TRUE, TRUE);
+        g_async_queue_unref(p->completed);
+}
diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h
index 4f51b250d1d4..6502e422cea8 100644
--- a/hw/9pfs/virtio-9p-coth.h
+++ b/hw/9pfs/virtio-9p-coth.h
@@ -56,6 +56,7 @@ typedef struct V9fsThPool {
 
 extern void co_run_in_worker_bh(void *);
 extern int v9fs_init_worker_threads(void);
+extern int v9fs_release_worker_threads(void);
 extern int v9fs_co_readlink(V9fsPDU *, V9fsPath *, V9fsString *);
 extern int v9fs_co_readdir_r(V9fsPDU *, V9fsFidState *,
                            struct dirent *, struct dirent **result);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]