comparison include/SDL_thread.h @ 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 d3baf5ac4e37
children f7b03b6838cb
comparison
equal deleted inserted replaced
3577:72024425b437 3578:0d1b16ee0bca
44 #endif 44 #endif
45 45
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
50 /* The SDL thread ID */
51 typedef unsigned long SDL_threadID;
49 52
50 #if defined(__WIN32__) && !defined(HAVE_LIBC) 53 #if defined(__WIN32__) && !defined(HAVE_LIBC)
51 /** 54 /**
52 * \file SDL_thread.h 55 * \file SDL_thread.h
53 * 56 *
125 SDL_CreateThread(int (SDLCALL * fn) (void *), void *data); 128 SDL_CreateThread(int (SDLCALL * fn) (void *), void *data);
126 129
127 #endif 130 #endif
128 131
129 /** 132 /**
130 * Get the 32-bit thread identifier for the current thread. 133 * Get the thread identifier for the current thread.
131 */ 134 */
132 extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); 135 extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
133 136
134 /** 137 /**
135 * Get the 32-bit thread identifier for the specified thread. 138 * Get the thread identifier for the specified thread.
136 * 139 *
137 * Equivalent to SDL_ThreadID() if the specified thread is NULL. 140 * Equivalent to SDL_ThreadID() if the specified thread is NULL.
138 */ 141 */
139 extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread * thread); 142 extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
140 143
141 /** 144 /**
142 * Wait for a thread to finish. 145 * Wait for a thread to finish.
143 * 146 *
144 * The return code for the thread function is placed in the area 147 * The return code for the thread function is placed in the area