[Spice-devel] [spice-server 4/4] fixup! worker: use glib main loop
Christophe Fergeau
cfergeau at redhat.com
Thu Jan 21 05:14:59 PST 2016
---
server/red-worker.c | 29 ++++-------------------------
server/red-worker.h | 1 -
2 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/server/red-worker.c b/server/red-worker.c
index 24bb435..f813649 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -64,7 +64,6 @@ struct RedWorker {
int running;
SpiceCoreInterfaceInternal core;
- GMainContext *main_context;
unsigned int event_timeout;
DisplayChannel *display_channel;
@@ -91,13 +90,6 @@ struct RedWorker {
FILE *record_fd;
};
-GMainContext* red_worker_get_main_context(RedWorker *worker)
-{
- spice_return_val_if_fail(worker, NULL);
-
- return worker->main_context;
-}
-
QXLInstance* red_worker_get_qxl(RedWorker *worker)
{
spice_return_val_if_fail(worker != NULL, NULL);
@@ -509,19 +501,6 @@ static int common_channel_config_socket(RedChannelClient *rcc)
return TRUE;
}
-static inline GMainContext *event_loop_context_from_iface(const SpiceCoreInterfaceInternal *iface)
-{
- RedWorker *worker = SPICE_CONTAINEROF(iface, RedWorker, core);
-
- return worker->main_context;
-}
-
-static void event_loop_channel_event(int event, SpiceChannelEventInfo *info)
-{
-}
-
-#include "event-loop.tmpl.c"
-
CommonChannelClient *common_channel_new_client(CommonChannel *common,
int size,
RedClient *client,
@@ -1542,7 +1521,7 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
worker = spice_new0(RedWorker, 1);
worker->core = event_loop_core;
- worker->main_context = g_main_context_new();
+ worker->core.main_context = g_main_context_new();
record_filename = getenv("SPICE_WORKER_RECORD_FILENAME");
if (record_filename) {
@@ -1580,12 +1559,12 @@ RedWorker* red_worker_new(QXLInstance *qxl, RedDispatcher *red_dispatcher)
GIOChannel *channel = g_io_channel_unix_new(dispatcher_get_recv_fd(dispatcher));
GSource *source = g_io_create_watch(channel, G_IO_IN);
g_source_set_callback(source, (GSourceFunc)worker_dispatcher_cb, worker, NULL);
- g_source_attach(source, worker->main_context);
+ g_source_attach(source, worker->core.main_context);
g_source_unref(source);
source = g_source_new(&worker_source_funcs, sizeof(RedWorkerSource));
SPICE_CONTAINEROF(source, RedWorkerSource, source)->worker = worker;
- g_source_attach(source, worker->main_context);
+ g_source_attach(source, worker->core.main_context);
g_source_unref(source);
memslot_info_init(&worker->mem_slots,
@@ -1618,7 +1597,7 @@ SPICE_GNUC_NORETURN static void *red_worker_main(void *arg)
RED_CHANNEL(worker->cursor_channel)->thread_id = pthread_self();
RED_CHANNEL(worker->display_channel)->thread_id = pthread_self();
- GMainLoop *loop = g_main_loop_new(worker->main_context, FALSE);
+ GMainLoop *loop = g_main_loop_new(worker->core.main_context, FALSE);
g_main_loop_run(loop);
g_main_loop_unref(loop);
diff --git a/server/red-worker.h b/server/red-worker.h
index 6bcab3d..91533e1 100644
--- a/server/red-worker.h
+++ b/server/red-worker.h
@@ -97,7 +97,6 @@ bool red_worker_run(RedWorker *worker);
QXLInstance* red_worker_get_qxl(RedWorker *worker);
RedChannel* red_worker_get_cursor_channel(RedWorker *worker);
RedChannel* red_worker_get_display_channel(RedWorker *worker);
-GMainContext* red_worker_get_main_context(RedWorker *worker);
RedMemSlotInfo* red_worker_get_memslot(RedWorker *worker);
void red_drawable_unref(RedWorker *worker, RedDrawable *red_drawable,
--
2.5.0
More information about the Spice-devel
mailing list