Mercurial > sdl-ios-xcode
comparison src/thread/pthread/SDL_systhread.c @ 3578:0d1b16ee0bca
Fixed bug #741
The thread ID is an unsigned long so it can hold pthread_t so people can do naughty things with it.
I'm going to be adding additional useful thread API functions, but this should prevent crashes in people's existing code on 64-bit architectures.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 16 Dec 2009 04:48:11 +0000 |
parents | dc1eb82ffdaa |
children | f7b03b6838cb |
comparison
equal
deleted
inserted
replaced
3577:72024425b437 | 3578:0d1b16ee0bca |
---|---|
36 | 36 |
37 #ifdef __RISCOS__ | 37 #ifdef __RISCOS__ |
38 /* RISC OS needs to know the main thread for | 38 /* RISC OS needs to know the main thread for |
39 * it's timer and event processing. */ | 39 * it's timer and event processing. */ |
40 int riscos_using_threads = 0; | 40 int riscos_using_threads = 0; |
41 Uint32 riscos_main_thread = 0; /* Thread running events */ | 41 SDL_threadID riscos_main_thread = 0; /* Thread running events */ |
42 #endif | 42 #endif |
43 | 43 |
44 | 44 |
45 static void * | 45 static void * |
46 RunThread(void *data) | 46 RunThread(void *data) |
97 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); | 97 pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldstate); |
98 } | 98 } |
99 #endif | 99 #endif |
100 } | 100 } |
101 | 101 |
102 /* WARNING: This may not work for systems with 64-bit pid_t */ | 102 SDL_threadID |
103 Uint32 | |
104 SDL_ThreadID(void) | 103 SDL_ThreadID(void) |
105 { | 104 { |
106 return ((Uint32) pthread_self()); | 105 return ((SDL_threadID) pthread_self()); |
107 } | 106 } |
108 | 107 |
109 void | 108 void |
110 SDL_SYS_WaitThread(SDL_Thread * thread) | 109 SDL_SYS_WaitThread(SDL_Thread * thread) |
111 { | 110 { |