Port all thread related functions to SDL

Setting thread priorities has been dropped (it is not portable).
The background download thread now exits gracefully.
g_threads is not public anymore.
This commit is contained in:
dhewg 2011-12-20 22:03:26 +01:00 committed by Daniel Gibson
parent 3c2c603cf4
commit f1a7b426fe
3 changed files with 7 additions and 24 deletions

View file

@ -184,8 +184,6 @@ if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
if (MINGW)
set(ldflags ${ldflags} "-mwindows")
else()
set(sys_libs ${sys_libs} pthread)
endif()
if (os STREQUAL "linux")
@ -618,7 +616,6 @@ if (APPLE)
sys/sys_local.cpp
sys/posix/posix_net.cpp
sys/posix/posix_signal.cpp
sys/posix/posix_threads.cpp
sys/posix/posix_main.cpp
)
@ -660,7 +657,6 @@ else()
sys/sys_local.cpp
sys/posix/posix_net.cpp
sys/posix/posix_signal.cpp
sys/posix/posix_threads.cpp
sys/posix/posix_main.cpp
sys/linux/main.cpp
)

View file

@ -66,8 +66,6 @@ If you have questions concerning this license or the applicable additional terms
#define assertmem( x, y )
#endif
#define THREAD_RETURN_TYPE DWORD
#endif
@ -107,8 +105,6 @@ If you have questions concerning this license or the applicable additional terms
#define assertmem( x, y )
#define THREAD_RETURN_TYPE void *
#endif
@ -163,8 +159,6 @@ If you have questions concerning this license or the applicable additional terms
#define assertmem( x, y )
#define THREAD_RETURN_TYPE void *
#endif

View file

@ -358,28 +358,21 @@ void Sys_ShutdownNetworking( void );
==============================================================
*/
typedef THREAD_RETURN_TYPE (*xthread_t)( void * );
struct SDL_Thread;
typedef enum {
THREAD_NORMAL,
THREAD_ABOVE_NORMAL,
THREAD_HIGHEST
} xthreadPriority;
typedef int (*xthread_t)( void * );
typedef struct {
const char * name;
intptr_t threadHandle;
size_t threadId;
const char *name;
SDL_Thread *threadHandle;
unsigned int threadId;
} xthreadInfo;
extern xthreadInfo *g_threads[MAX_THREADS];
extern int g_thread_count;
void Sys_CreateThread( xthread_t function, void *parms, xthreadPriority priority, xthreadInfo &info, const char *name, xthreadInfo *threads[MAX_THREADS], int *thread_count );
void Sys_CreateThread( xthread_t function, void *parms, xthreadInfo &info, const char *name );
void Sys_DestroyThread( xthreadInfo& info ); // sets threadHandle back to 0
// find the name of the calling thread
// if index != NULL, set the index in g_threads array (use -1 for "main" thread)
// if index != NULL, set the index in threads array (use -1 for "main" thread)
const char * Sys_GetThreadName( int *index = 0 );
extern void Sys_InitThreads();