[client] switch from SDL_Thread to lgThread

This commit is contained in:
Geoffrey McRae 2020-01-02 23:59:06 +11:00
parent 1c1d2a0568
commit ba31c78412
4 changed files with 18 additions and 16 deletions

View File

@ -1 +1 @@
B1-41-g0c6ff6822d+1 B1-42-g1c1d2a0568+1

View File

@ -39,6 +39,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "common/crash.h" #include "common/crash.h"
#include "common/KVMFR.h" #include "common/KVMFR.h"
#include "common/stringutils.h" #include "common/stringutils.h"
#include "common/thread.h"
#include "utils.h" #include "utils.h"
#include "kb.h" #include "kb.h"
#include "ll.h" #include "ll.h"
@ -52,9 +53,10 @@ static bool b_startup = false;
static SDL_mutex *m_startup; static SDL_mutex *m_startup;
static SDL_cond *c_startup; static SDL_cond *c_startup;
static SDL_Thread *t_spice = NULL; static LGThread *t_spice = NULL;
static SDL_Thread *t_render = NULL; static LGThread *t_render = NULL;
static SDL_Thread *t_cursor = NULL; static LGThread *t_cursor = NULL;
static LGThread *t_frame = NULL;
static SDL_Cursor *cursor = NULL; static SDL_Cursor *cursor = NULL;
struct AppState state; struct AppState state;
@ -171,10 +173,10 @@ static int renderThread(void * unused)
state.running = false; state.running = false;
if (t_cursor) if (t_cursor)
SDL_WaitThread(t_cursor, NULL); lgJoinThread(t_cursor, NULL);
if (state.t_frame) if (t_frame)
SDL_WaitThread(state.t_frame, NULL); lgJoinThread(t_frame, NULL);
state.lgr->deinitialize(state.lgrData); state.lgr->deinitialize(state.lgrData);
state.lgr = NULL; state.lgr = NULL;
@ -1107,7 +1109,7 @@ static int lg_run()
return -1; return -1;
} }
if (!(t_spice = SDL_CreateThread(spiceThread, "spiceThread", NULL))) if (!lgCreateThread("spiceThread", spiceThread, NULL, &t_spice))
{ {
DEBUG_ERROR("spice create thread failed"); DEBUG_ERROR("spice create thread failed");
return -1; return -1;
@ -1271,7 +1273,7 @@ static int lg_run()
c_startup = SDL_CreateCond(); c_startup = SDL_CreateCond();
// start the renderThread so we don't just display junk // start the renderThread so we don't just display junk
if (!(t_render = SDL_CreateThread(renderThread, "renderThread", NULL))) if (!lgCreateThread("renderThread", renderThread, NULL, &t_render))
{ {
DEBUG_ERROR("render create thread failed"); DEBUG_ERROR("render create thread failed");
return -1; return -1;
@ -1309,13 +1311,13 @@ static int lg_run()
return -1; return -1;
} }
if (!(t_cursor = SDL_CreateThread(cursorThread, "cursorThread", NULL))) if (!lgCreateThread("cursorThread", cursorThread, NULL, &t_cursor))
{ {
DEBUG_ERROR("cursor create thread failed"); DEBUG_ERROR("cursor create thread failed");
return 1; return 1;
} }
if (!(state.t_frame = SDL_CreateThread(frameThread, "frameThread", NULL))) if (!lgCreateThread("frameThread", frameThread, NULL, &t_frame))
{ {
DEBUG_ERROR("frame create thread failed"); DEBUG_ERROR("frame create thread failed");
return -1; return -1;
@ -1357,7 +1359,7 @@ static void lg_shutdown()
state.running = false; state.running = false;
if (t_render) if (t_render)
SDL_WaitThread(t_render, NULL); lgJoinThread(t_render, NULL);
if (m_startup) if (m_startup)
{ {
@ -1379,7 +1381,7 @@ static void lg_shutdown()
} }
if (t_spice) if (t_spice)
SDL_WaitThread(t_spice, NULL); lgJoinThread(t_spice, NULL);
spice_disconnect(); spice_disconnect();
} }

View File

@ -49,8 +49,6 @@ struct AppState
void * lgrData; void * lgrData;
bool lgrResize; bool lgrResize;
SDL_Thread * t_frame;
const LG_Clipboard * lgc; const LG_Clipboard * lgc;
SpiceDataType cbType; SpiceDataType cbType;
struct ll * cbRequestList; struct ll * cbRequestList;

View File

@ -15,3 +15,5 @@ add_library(lg_common_platform_code STATIC
if(ENABLE_BACKTRACE) if(ENABLE_BACKTRACE)
target_link_libraries(lg_common_platform_code bfd) target_link_libraries(lg_common_platform_code bfd)
endif() endif()
target_link_libraries(lg_common_platform_code pthread)