Home | History | Annotate | Download | only in thread

Lines Matching defs:thread

24 /* System independent thread management routines for SDL */
33 (except the main thread)
56 they will no longer have access to any per-thread data.
69 /* Routines for manipulating the thread list */
70 static void SDL_AddThread(SDL_Thread *thread)
76 is only one thread running the first time this is called.
87 printf("Adding thread (%d already - %d max)\n",
101 SDL_Threads[SDL_numthreads++] = thread;
106 static void SDL_DelThread(SDL_Thread *thread)
115 if ( thread == SDL_Threads[i] ) {
131 printf("Deleting thread (%d left - %d max)\n",
137 #if 0 /* There could be memory corruption if another thread is starting */
144 /* The default (non-thread-safe) global error variable */
147 /* Routine to get the thread-specific error variable */
171 /* Arguments and callback to setup and run the user thread function */
191 /* Get the thread id */
200 /* Wake up the parent thread */
214 SDL_Thread *thread;
218 /* Allocate memory for the thread info structure */
219 thread = (SDL_Thread *)SDL_malloc(sizeof(*thread));
220 if ( thread == NULL ) {
224 SDL_memset(thread, 0, (sizeof *thread));
225 thread->status = -1;
227 /* Set up the arguments for the thread */
231 SDL_free(thread);
236 args->info = thread;
239 SDL_free(thread);
244 /* Add the thread to the list of available threads */
245 SDL_AddThread(thread);
247 /* Create the thread and go! */
249 ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread);
251 ret = SDL_SYS_CreateThread(thread, args);
254 /* Wait for the thread function to use arguments */
258 SDL_DelThread(thread);
259 SDL_free(thread);
260 thread = NULL;
266 return(thread);
269 void SDL_WaitThread(SDL_Thread *thread, int *status)
271 if ( thread ) {
272 SDL_SYS_WaitThread(thread);
274 *status = thread->status;
276 SDL_DelThread(thread);
277 SDL_free(thread);
281 Uint32 SDL_GetThreadID(SDL_Thread *thread)
285 if ( thread ) {
286 id = thread->threadid;
293 void SDL_KillThread(SDL_Thread *thread)
295 if ( thread ) {
296 SDL_SYS_KillThread(thread);
297 SDL_WaitThread(thread, NULL);