comparison src/SDL.c @ 3696:47d923feedb0

Fixed bug #935 Patrice Mandin Hello, I originally added pth support for threads in SDL 1.2 because on the Atari platform we did not have any thread library. I think pth support could be removed from SDL 1.3 for two reasons: - Atari platform removed - pth does not provides real (preemptive) threads, because it is user space, and expect the application to call one of its function to give CPU to another thread. So it is not exactly useful for applications, that expect threads to run simultaneously.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 24 Jan 2010 20:47:20 +0000
parents bc50cd16bb07
children f7b03b6838cb
comparison
equal deleted inserted replaced
3695:f6a8be3fefa0 3696:47d923feedb0
27 #include "SDL_fatal.h" 27 #include "SDL_fatal.h"
28 #include "SDL_assert.h" 28 #include "SDL_assert.h"
29 29
30 #if !SDL_VIDEO_DISABLED 30 #if !SDL_VIDEO_DISABLED
31 #include "video/SDL_leaks.h" 31 #include "video/SDL_leaks.h"
32 #endif
33
34 #if SDL_THREAD_PTH
35 #include <pth.h>
36 #endif 32 #endif
37 33
38 /* Initialization/Cleanup routines */ 34 /* Initialization/Cleanup routines */
39 #if !SDL_JOYSTICK_DISABLED 35 #if !SDL_JOYSTICK_DISABLED
40 extern int SDL_JoystickInit(void); 36 extern int SDL_JoystickInit(void);
150 } 146 }
151 147
152 int 148 int
153 SDL_Init(Uint32 flags) 149 SDL_Init(Uint32 flags)
154 { 150 {
155 #if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
156 if (!pth_init()) {
157 return -1;
158 }
159 #endif
160
161 if (SDL_AssertionsInit() < 0) { 151 if (SDL_AssertionsInit() < 0) {
162 return -1; 152 return -1;
163 } 153 }
164 154
165 /* Clear the error message */ 155 /* Clear the error message */
264 /* Uninstall any parachute signal handlers */ 254 /* Uninstall any parachute signal handlers */
265 SDL_UninstallParachute(); 255 SDL_UninstallParachute();
266 256
267 SDL_AssertionsQuit(); 257 SDL_AssertionsQuit();
268 258
269 #if !SDL_THREADS_DISABLED && SDL_THREAD_PTH
270 pth_kill();
271 #endif
272 #ifdef DEBUG_BUILD 259 #ifdef DEBUG_BUILD
273 printf("[SDL_Quit] : Returning!\n"); 260 printf("[SDL_Quit] : Returning!\n");
274 fflush(stdout); 261 fflush(stdout);
275 #endif 262 #endif
276 263