os2: updates to SDL_systhread.c: removed lots of garbage. added SDL_PASSED_BEGINTHREAD_ENDTHREAD guard, because the code requires it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
diff --git a/src/thread/os2/SDL_systhread.c b/src/thread/os2/SDL_systhread.c
index 15453f7..878aa60 100644
--- a/src/thread/os2/SDL_systhread.c
+++ b/src/thread/os2/SDL_systhread.c
@@ -30,50 +30,15 @@
#include "../SDL_systhread.h"
#include "SDL_systls_c.h"
#include "../../core/os2/SDL_os2.h"
+#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#error This source only adjusted for SDL_PASSED_BEGINTHREAD_ENDTHREAD
+#endif
#define INCL_DOSPROCESS
#define INCL_DOSERRORS
#include <os2.h>
-
-#ifndef SDL_PASSED_BEGINTHREAD_ENDTHREAD
-/* We'll use the C library from this DLL */
#include <process.h>
-/* Cygwin gcc-3 ... MingW64 (even with a i386 host) does this like MSVC. */
-#if (defined(__MINGW32__) && (__GNUC__ < 4))
-typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
- unsigned, unsigned *threadID);
-typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
-
-#elif defined(__WATCOMC__)
-/* This is for Watcom targets except OS2 */
-#if __WATCOMC__ < 1240
-#define __watcall
-#endif
-typedef unsigned long (__watcall * pfnSDL_CurrentBeginThread) (void *,
- unsigned,
- unsigned
- (__stdcall *
- func) (void
- *),
- void *arg,
- unsigned,
- unsigned
- *threadID);
-typedef void (__watcall * pfnSDL_CurrentEndThread) (unsigned code);
-
-#else
-typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *
- func) (void
- *),
- void *arg, unsigned,
- unsigned *threadID);
-typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
-#endif
-#endif /* !SDL_PASSED_BEGINTHREAD_ENDTHREAD */
-
typedef struct ThreadStartParms {
void *args;
@@ -99,15 +64,10 @@ static void RunThread(void *data)
-#ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
int
SDL_SYS_CreateThread(SDL_Thread * thread, void *args,
pfnSDL_CurrentBeginThread pfnBeginThread,
pfnSDL_CurrentEndThread pfnEndThread)
-#else
-int
-SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
-#endif /* SDL_PASSED_BEGINTHREAD_ENDTHREAD */
{
pThreadStartParms pThreadParms = SDL_malloc( sizeof(tThreadStartParms) );
@@ -121,11 +81,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
// Start the thread using the runtime library of calling app!
thread->handle = (SYS_ThreadHandle)
- #ifdef SDL_PASSED_BEGINTHREAD_ENDTHREAD
( (size_t) pfnBeginThread( RunThread, NULL, 65535, pThreadParms ) );
- #else
- _beginthread( RunThread, NULL, 65535, pThreadParms );
- #endif
if ( thread->handle == -1 )
return SDL_SetError( "Not enough resources to create thread" );
@@ -155,11 +111,9 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
ULONG ulRC;
ulRC = DosSetPriority( PRTYS_THREAD,
- priority == SDL_THREAD_PRIORITY_LOW
- ? PRTYC_IDLETIME
- : priority == SDL_THREAD_PRIORITY_HIGH
- ? PRTYC_TIMECRITICAL
- : PRTYC_REGULAR ,
+ (priority < SDL_THREAD_PRIORITY_NORMAL)? PRTYC_IDLETIME :
+ (priority > SDL_THREAD_PRIORITY_NORMAL)? PRTYC_TIMECRITICAL :
+ PRTYC_REGULAR,
0, 0 );
if ( ulRC != NO_ERROR )
return SDL_SetError( "DosSetPriority() failed, rc = %u", ulRC );
@@ -179,7 +133,7 @@ SDL_SYS_WaitThread(SDL_Thread * thread)
void
SDL_SYS_DetachThread(SDL_Thread * thread)
{
- return;
+ /* nothing. */
}
#endif /* SDL_THREAD_OS2 */