equal
deleted
inserted
replaced
46 /* The SDL thread structure, defined in SDL_thread.c */ |
46 /* The SDL thread structure, defined in SDL_thread.c */ |
47 struct SDL_Thread; |
47 struct SDL_Thread; |
48 typedef struct SDL_Thread SDL_Thread; |
48 typedef struct SDL_Thread SDL_Thread; |
49 |
49 |
50 /* Create a thread */ |
50 /* Create a thread */ |
51 #if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__) |
51 #if defined(__WIN32__) && !defined(HAVE_LIBC) |
52 /* |
52 /* |
53 We compile SDL into a DLL on OS/2. This means, that it's the DLL which |
53 We compile SDL into a DLL. This means, that it's the DLL which |
54 creates a new thread for the calling process with the SDL_CreateThread() |
54 creates a new thread for the calling process with the SDL_CreateThread() |
55 API. There is a problem with this, that only the RTL of the SDL.DLL will |
55 API. There is a problem with this, that only the RTL of the SDL.DLL will |
56 be initialized for those threads, and not the RTL of the calling application! |
56 be initialized for those threads, and not the RTL of the calling application! |
57 To solve this, we make a little hack here. |
57 To solve this, we make a little hack here. |
58 We'll always use the caller's _beginthread() and _endthread() APIs to |
58 We'll always use the caller's _beginthread() and _endthread() APIs to |
65 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD |
65 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD |
66 #ifndef _WIN32_WCE |
66 #ifndef _WIN32_WCE |
67 #include <process.h> /* This has _beginthread() and _endthread() defined! */ |
67 #include <process.h> /* This has _beginthread() and _endthread() defined! */ |
68 #endif |
68 #endif |
69 |
69 |
70 #ifdef __OS2__ |
70 #ifdef __GNUC__ |
71 typedef int (*pfnSDL_CurrentBeginThread) (void (*func) (void *), void *, |
|
72 unsigned, void *arg); |
|
73 typedef void (*pfnSDL_CurrentEndThread) (void); |
|
74 #elif __GNUC__ |
|
75 typedef unsigned long (__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, |
71 typedef unsigned long (__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, |
76 unsigned |
72 unsigned |
77 (__stdcall * |
73 (__stdcall * |
78 func) (void *), |
74 func) (void *), |
79 void *arg, |
75 void *arg, |
94 extern DECLSPEC SDL_Thread *SDLCALL |
90 extern DECLSPEC SDL_Thread *SDLCALL |
95 SDL_CreateThread(int (SDLCALL * f) (void *), void *data, |
91 SDL_CreateThread(int (SDLCALL * f) (void *), void *data, |
96 pfnSDL_CurrentBeginThread pfnBeginThread, |
92 pfnSDL_CurrentBeginThread pfnBeginThread, |
97 pfnSDL_CurrentEndThread pfnEndThread); |
93 pfnSDL_CurrentEndThread pfnEndThread); |
98 |
94 |
99 #ifdef __OS2__ |
95 #if defined(_WIN32_WCE) |
100 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread) |
|
101 #elif defined(_WIN32_WCE) |
|
102 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL) |
96 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL) |
103 #else |
97 #else |
104 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex) |
98 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex) |
105 #endif |
99 #endif |
106 #else |
100 #else |