[Spice-devel] [PATCH 3/7] red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message
Frediano Ziglio
fziglio at redhat.com
Wed Oct 14 08:37:32 PDT 2015
Allows to close main thread.
For the moment there is no correct cleanup.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/red_dispatcher.h | 3 +++
server/red_worker.c | 10 ++++++++++
server/red_worker.h | 3 +++
3 files changed, 16 insertions(+)
diff --git a/server/red_dispatcher.h b/server/red_dispatcher.h
index 320b7e3..3461ba4 100644
--- a/server/red_dispatcher.h
+++ b/server/red_dispatcher.h
@@ -206,4 +206,7 @@ typedef struct RedWorkerMessageMonitorsConfigAsync {
typedef struct RedWorkerMessageDriverUnload {
} RedWorkerMessageDriverUnload;
+typedef struct RedWorkerMessageClose {
+} RedWorkerMessageClose;
+
#endif
diff --git a/server/red_worker.c b/server/red_worker.c
index babb597..7e11752 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -11844,6 +11844,11 @@ void handle_dev_driver_unload(void *opaque, void *payload)
worker->driver_cap_monitors_config = 0;
}
+SPICE_GNUC_NORETURN static void handle_dev_close(void *opaque, void *payload)
+{
+ pthread_exit(NULL);
+}
+
static int loadvm_command(RedWorker *worker, QXLCommandExt *ext)
{
RedCursorCmd *cursor_cmd;
@@ -12088,6 +12093,11 @@ static void register_callbacks(Dispatcher *dispatcher)
handle_dev_driver_unload,
sizeof(RedWorkerMessageDriverUnload),
DISPATCHER_NONE);
+ dispatcher_register_handler(dispatcher,
+ RED_WORKER_MESSAGE_CLOSE_WORKER,
+ handle_dev_close,
+ sizeof(RedWorkerMessageClose),
+ DISPATCHER_NONE);
}
diff --git a/server/red_worker.h b/server/red_worker.h
index ca8aadb..835bfca 100644
--- a/server/red_worker.h
+++ b/server/red_worker.h
@@ -70,6 +70,9 @@ enum {
RED_WORKER_MESSAGE_MONITORS_CONFIG_ASYNC,
RED_WORKER_MESSAGE_DRIVER_UNLOAD,
+ /* close worker thread */
+ RED_WORKER_MESSAGE_CLOSE_WORKER,
+
RED_WORKER_MESSAGE_COUNT // LAST
};
--
2.4.3
More information about the Spice-devel
mailing list