From 670f2f2be81bd012ed50dd994f6e48a22241f300 Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 1 Dec 2011 18:01:13 +0100 Subject: [PATCH] Fix platform dependent thread function definitions Thread return types are different between platforms, and its probably not a good idea to return something of a different size, cast the callback and expect it to not crash. --- sys/sys_public.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/sys_public.h b/sys/sys_public.h index ba5d90f..93a543d 100644 --- a/sys/sys_public.h +++ b/sys/sys_public.h @@ -59,6 +59,8 @@ If you have questions concerning this license or the applicable additional terms #define assertmem( x, y ) assert( _CrtIsValidPointer( x, y, true ) ) +#define THREAD_RETURN_TYPE dword + #endif // Mac OSX @@ -97,6 +99,8 @@ If you have questions concerning this license or the applicable additional terms #define assertmem( x, y ) +#define THREAD_RETURN_TYPE void * + #endif @@ -136,6 +140,8 @@ If you have questions concerning this license or the applicable additional terms #define assertmem( x, y ) +#define THREAD_RETURN_TYPE void * + #endif #ifdef __GNUC__ @@ -482,7 +488,7 @@ void Sys_ShutdownNetworking( void ); ============================================================== */ -typedef unsigned int (*xthread_t)( void * ); +typedef THREAD_RETURN_TYPE (*xthread_t)( void * ); typedef enum { THREAD_NORMAL, @@ -492,8 +498,8 @@ typedef enum { typedef struct { const char * name; - int threadHandle; - unsigned long threadId; + intptr_t threadHandle; + size_t threadId; } xthreadInfo; const int MAX_THREADS = 10;