Mercurial > sdl-ios-xcode
comparison src/events/SDL_events.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 | a67a961e2171 |
children | 57823d017f02 |
comparison
equal
deleted
inserted
replaced
3577:72024425b437 | 3578:0d1b16ee0bca |
---|---|
60 int safe; | 60 int safe; |
61 } SDL_EventLock; | 61 } SDL_EventLock; |
62 | 62 |
63 /* Thread functions */ | 63 /* Thread functions */ |
64 static SDL_Thread *SDL_EventThread = NULL; /* Thread handle */ | 64 static SDL_Thread *SDL_EventThread = NULL; /* Thread handle */ |
65 static Uint32 event_thread; /* The event thread id */ | 65 static SDL_threadID event_thread; /* The event thread id */ |
66 | 66 |
67 void | 67 void |
68 SDL_Lock_EventThread(void) | 68 SDL_Lock_EventThread(void) |
69 { | 69 { |
70 if (SDL_EventThread && (SDL_ThreadID() != event_thread)) { | 70 if (SDL_EventThread && (SDL_ThreadID() != event_thread)) { |
181 SDL_DestroyMutex(SDL_EventQ.lock); | 181 SDL_DestroyMutex(SDL_EventQ.lock); |
182 SDL_EventQ.lock = NULL; | 182 SDL_EventQ.lock = NULL; |
183 } | 183 } |
184 } | 184 } |
185 | 185 |
186 Uint32 | 186 SDL_threadID |
187 SDL_EventThreadID(void) | 187 SDL_EventThreadID(void) |
188 { | 188 { |
189 return (event_thread); | 189 return (event_thread); |
190 } | 190 } |
191 | 191 |