From d5407378ace043d6a25d68894d31daef96a82a77 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Sat, 24 Aug 2019 18:12:59 -0700 Subject: [PATCH] Bridge the gap between SDL1, SDL2, and UQM threads --- sc2/src/libs/threads/sdl/sdlthreads.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sc2/src/libs/threads/sdl/sdlthreads.c b/sc2/src/libs/threads/sdl/sdlthreads.c index c2aba143e..bbbd5ec44 100644 --- a/sc2/src/libs/threads/sdl/sdlthreads.c +++ b/sc2/src/libs/threads/sdl/sdlthreads.c @@ -255,8 +255,17 @@ CreateThread_SDL (ThreadFunction func, void *data, SDWORD stackSize startInfo->data = data; startInfo->sem = SDL_CreateSemaphore (0); startInfo->thread = thread; - + +#if SDL_MAJOR_VERSION == 1 + // SDL1 case thread->native = SDL_CreateThread (ThreadHelper, (void *) startInfo); +#elif defined(NAMED_SYNCHRO) + // SDL2 with UQM-aware named threads case + thread->native = SDL_CreateThread (ThreadHelper, thread->name, (void *) startInfo); +#else + // SDL2 without UQM-aware named threads; use a placeholder for debuggers + thread->native = SDL_CreateThread (ThreadHelper, "UQM worker thread", (void *)startInfo); +#endif if (!(thread->native)) { DestroyThreadLocal (thread->localData);