From 6384a8d00654990a384d7f6ebc3c8c09fc1a6407 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Tue, 24 May 2022 11:06:47 +1000 Subject: [PATCH] [client] main: fix race condition on usage of events --- client/src/main.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index 9756d304..4a1ce02b 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1178,6 +1178,20 @@ static int lg_run(void) return -1; } + // setup the startup condition + if (!(e_startup = lgCreateEvent(false, 0))) + { + DEBUG_ERROR("failed to create the startup event"); + return -1; + } + + // setup the new frame event + if (!(g_state.frameEvent = lgCreateEvent(!g_state.jitRender, 0))) + { + DEBUG_ERROR("failed to create the frame event"); + return -1; + } + //setup the render command queue renderQueue_init(); @@ -1290,20 +1304,6 @@ static int lg_run(void) keybind_commonRegister(); - // setup the startup condition - if (!(e_startup = lgCreateEvent(false, 0))) - { - DEBUG_ERROR("failed to create the startup event"); - return -1; - } - - // setup the new frame event - if (!(g_state.frameEvent = lgCreateEvent(!g_state.jitRender, 0))) - { - DEBUG_ERROR("failed to create the frame event"); - return -1; - } - if (g_state.jitRender) DEBUG_INFO("Using JIT render mode");