diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-09-02 22:01:26 +0200 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2015-10-19 13:11:13 +0100 |
commit | 314dfefca38e42bd6177385adf3043cfbf4ba07e (patch) | |
tree | 14005870ac67392e00951a87d210b1fca0ca458f /server/red_dispatcher.c | |
parent | b15527e06352acc38fff7601cb22301a85afe410 (diff) | |
download | spice-314dfefca38e42bd6177385adf3043cfbf4ba07e.tar.gz spice-314dfefca38e42bd6177385adf3043cfbf4ba07e.tar.xz spice-314dfefca38e42bd6177385adf3043cfbf4ba07e.zip |
worker: use GOnce to surround some global init in dispatcher
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Diffstat (limited to 'server/red_dispatcher.c')
-rw-r--r-- | server/red_dispatcher.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c index b11cd423..7ad860c3 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); |