[Spice-commits] server/red_dispatcher.c server/spice_server_utils.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon Oct 19 05:13:41 PDT 2015


 server/red_dispatcher.c     |   10 +++++++---
 server/spice_server_utils.h |    1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 314dfefca38e42bd6177385adf3043cfbf4ba07e
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Mon Sep 2 22:01:26 2013 +0200

    worker: use GOnce to surround some global init in dispatcher
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index b11cd42..7ad860c 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -1076,11 +1076,15 @@ void red_dispatcher_init(QXLInstance *qxl)
 
     spice_return_if_fail(qxl->st->dispatcher == NULL);
 
-    quic_init();
-    sw_canvas_init();
+    static gsize initialized = FALSE;
+    if (g_once_init_enter(&initialized)) {
+        quic_init();
+        sw_canvas_init();
 #ifdef USE_OPENGL
-    gl_canvas_init();
+        gl_canvas_init();
 #endif // USE_OPENGL
+        g_once_init_leave(&initialized, TRUE);
+    }
 
     red_dispatcher = spice_new0(RedDispatcher, 1);
     ring_init(&red_dispatcher->async_commands);
diff --git a/server/spice_server_utils.h b/server/spice_server_utils.h
index b3ddc27..c8135db 100644
--- a/server/spice_server_utils.h
+++ b/server/spice_server_utils.h
@@ -2,6 +2,7 @@
 #define H_SPICE_SERVER_UTIL
 
 #include <unistd.h>
+#include <glib.h>
 
 static inline void set_bit(int index, uint32_t *addr)
 {


More information about the Spice-commits mailing list