Add SDL2 support in sys/threads.cpp

This commit is contained in:
dhewg 2012-07-19 20:08:02 +02:00
parent 368bf2819c
commit a75387c55e

View file

@ -26,6 +26,7 @@ If you have questions concerning this license or the applicable additional terms
===========================================================================
*/
#include <SDL_version.h>
#include <SDL_mutex.h>
#include <SDL_thread.h>
#include <SDL_timer.h>
@ -109,7 +110,11 @@ void Sys_ShutdownThreads() {
continue;
Sys_Printf("WARNING: Thread '%s' still running\n", thread[i]->name);
#if SDL_VERSION_ATLEAST(2, 0, 0)
// TODO no equivalent in SDL2
#else
SDL_KillThread(thread[i]->threadHandle);
#endif
thread[i] = NULL;
}
@ -218,7 +223,11 @@ Sys_CreateThread
void Sys_CreateThread(xthread_t function, void *parms, xthreadInfo& info, const char *name) {
Sys_EnterCriticalSection();
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_Thread *t = SDL_CreateThread(function, name, parms);
#else
SDL_Thread *t = SDL_CreateThread(function, parms);
#endif
if (!t) {
common->Error("ERROR: SDL_thread for '%s' failed\n", name);