From f64310320a01f75174fda0f67aee45c5cde8dfdc Mon Sep 17 00:00:00 2001 From: Quantum Date: Sun, 1 Aug 2021 05:45:21 -0400 Subject: [PATCH] [client] ds: add stopWaitFrame to terminate waitFrame early This is used on exit to unblock the render thread. --- client/include/interface/displayserver.h | 4 ++++ client/src/main.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/client/include/interface/displayserver.h b/client/include/interface/displayserver.h index f729584f..94dd5be2 100644 --- a/client/include/interface/displayserver.h +++ b/client/include/interface/displayserver.h @@ -156,6 +156,9 @@ struct LG_DisplayServerOps /* This must be called when waitFrame returns, but no frame is actually rendered. */ void (*skipFrame)(void); + /* This is used to interrupt waitFrame. */ + void (*stopWaitFrame)(void); + /* dm specific cursor implementations */ void (*guestPointerUpdated)(double x, double y, double localX, double localY); void (*setPointer)(LG_DSPointer pointer); @@ -228,6 +231,7 @@ struct LG_DisplayServerOps ASSERT_OPENGL_FN((x)->glMakeCurrent ); \ ASSERT_OPENGL_FN((x)->glSetSwapInterval); \ ASSERT_OPENGL_FN((x)->glSwapBuffers ); \ + assert(!(x)->waitFrame == !(x)->stopWaitFrame); \ assert((x)->guestPointerUpdated); \ assert((x)->setPointer ); \ assert((x)->grabPointer ); \ diff --git a/client/src/main.c b/client/src/main.c index 6134ce40..050f96b4 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1163,6 +1163,8 @@ static void lg_shutdown(void) g_state.state = APP_STATE_SHUTDOWN; if (t_render) { + if (g_state.ds->stopWaitFrame) + g_state.ds->stopWaitFrame(); lgSignalEvent(e_startup); lgSignalEvent(g_state.frameEvent); lgJoinThread(t_render, NULL);