mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] spice: wait for the spice connection to finish at startup
A failure to connect to spice would cause LG to exit late, this adds a startup condition that prevents the LG initialization to complete until the spice connection has been established.
This commit is contained in:
parent
b94869249c
commit
1770defea2
@ -69,6 +69,7 @@
|
||||
static int renderThread(void * unused);
|
||||
|
||||
static LGEvent *e_startup = NULL;
|
||||
static LGEvent *e_spice = NULL;
|
||||
static LGThread *t_spice = NULL;
|
||||
static LGThread *t_render = NULL;
|
||||
|
||||
@ -888,6 +889,7 @@ void spiceReady(void)
|
||||
keybind_spiceRegister();
|
||||
|
||||
purespice_freeServerInfo(&info);
|
||||
lgSignalEvent(e_spice);
|
||||
}
|
||||
|
||||
static void spice_surfaceCreate(unsigned int surfaceId, PSSurfaceFormat format,
|
||||
@ -987,6 +989,7 @@ int spiceThread(void * arg)
|
||||
if (!purespice_connect(&config))
|
||||
{
|
||||
DEBUG_ERROR("Failed to connect to spice server");
|
||||
lgSignalEvent(e_spice);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -1024,6 +1027,7 @@ end:
|
||||
if (!g_state.spiceClose)
|
||||
g_state.state = APP_STATE_SHUTDOWN;
|
||||
|
||||
lgSignalEvent(e_spice);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1190,6 +1194,13 @@ static int lg_run(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// setup the spice startup condition
|
||||
if (!(e_spice = lgCreateEvent(false, 0)))
|
||||
{
|
||||
DEBUG_ERROR("failed to create the spice startup event");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// setup the startup condition
|
||||
if (!(e_startup = lgCreateEvent(false, 0)))
|
||||
{
|
||||
@ -1227,6 +1238,10 @@ static int lg_run(void)
|
||||
DEBUG_ERROR("spice create thread failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
lgWaitEvent(e_spice, TIMEOUT_INFINITE);
|
||||
if (!g_state.spiceReady)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// select and init a renderer
|
||||
@ -1664,6 +1679,12 @@ static void lg_shutdown(void)
|
||||
e_startup = NULL;
|
||||
}
|
||||
|
||||
if (e_spice)
|
||||
{
|
||||
lgFreeEvent(e_spice);
|
||||
e_startup = NULL;
|
||||
}
|
||||
|
||||
if (g_state.ds)
|
||||
g_state.ds->shutdown();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user