[client] ds: add stopWaitFrame to terminate waitFrame early

This is used on exit to unblock the render thread.
This commit is contained in:
Quantum 2021-08-01 05:45:21 -04:00 committed by Geoffrey McRae
parent 695b7b793c
commit f64310320a
2 changed files with 6 additions and 0 deletions

View file

@ -156,6 +156,9 @@ struct LG_DisplayServerOps
/* This must be called when waitFrame returns, but no frame is actually rendered. */ /* This must be called when waitFrame returns, but no frame is actually rendered. */
void (*skipFrame)(void); void (*skipFrame)(void);
/* This is used to interrupt waitFrame. */
void (*stopWaitFrame)(void);
/* dm specific cursor implementations */ /* dm specific cursor implementations */
void (*guestPointerUpdated)(double x, double y, double localX, double localY); void (*guestPointerUpdated)(double x, double y, double localX, double localY);
void (*setPointer)(LG_DSPointer pointer); void (*setPointer)(LG_DSPointer pointer);
@ -228,6 +231,7 @@ struct LG_DisplayServerOps
ASSERT_OPENGL_FN((x)->glMakeCurrent ); \ ASSERT_OPENGL_FN((x)->glMakeCurrent ); \
ASSERT_OPENGL_FN((x)->glSetSwapInterval); \ ASSERT_OPENGL_FN((x)->glSetSwapInterval); \
ASSERT_OPENGL_FN((x)->glSwapBuffers ); \ ASSERT_OPENGL_FN((x)->glSwapBuffers ); \
assert(!(x)->waitFrame == !(x)->stopWaitFrame); \
assert((x)->guestPointerUpdated); \ assert((x)->guestPointerUpdated); \
assert((x)->setPointer ); \ assert((x)->setPointer ); \
assert((x)->grabPointer ); \ assert((x)->grabPointer ); \

View file

@ -1163,6 +1163,8 @@ static void lg_shutdown(void)
g_state.state = APP_STATE_SHUTDOWN; g_state.state = APP_STATE_SHUTDOWN;
if (t_render) if (t_render)
{ {
if (g_state.ds->stopWaitFrame)
g_state.ds->stopWaitFrame();
lgSignalEvent(e_startup); lgSignalEvent(e_startup);
lgSignalEvent(g_state.frameEvent); lgSignalEvent(g_state.frameEvent);
lgJoinThread(t_render, NULL); lgJoinThread(t_render, NULL);