src/thread/SDL_thread.c
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
equal deleted inserted replaced
1329:bc67bbf87818 1330:450721ad5436
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
    22 
    22 
    23 /* System independent thread management routines for SDL */
    23 /* System independent thread management routines for SDL */
    24 
    24 
    25 #include <stdio.h>
       
    26 #include <stdlib.h>
       
    27 #include <string.h>
       
    28 
       
    29 #include "SDL_error.h"
    25 #include "SDL_error.h"
    30 #include "SDL_mutex.h"
    26 #include "SDL_mutex.h"
    31 #include "SDL_thread.h"
    27 #include "SDL_thread.h"
       
    28 #include "SDL_stdlib.h"
       
    29 #include "SDL_string.h"
    32 #include "SDL_thread_c.h"
    30 #include "SDL_thread_c.h"
    33 #include "SDL_systhread.h"
    31 #include "SDL_systhread.h"
    34 
    32 
    35 #define ARRAY_CHUNKSIZE	32
    33 #define ARRAY_CHUNKSIZE	32
    36 /* The array of threads currently active in the application
    34 /* The array of threads currently active in the application
   211 
   209 
   212 	/* Run the function */
   210 	/* Run the function */
   213 	*statusloc = userfunc(userdata);
   211 	*statusloc = userfunc(userdata);
   214 }
   212 }
   215 
   213 
   216 #ifdef __OS2__
   214 #if defined(_WIN32) || defined(__OS2__)
   217 DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread_Core(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
   215 #undef SDL_CreateThread
       
   216 DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread)
   218 #else
   217 #else
   219 DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data)
   218 DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (*fn)(void *), void *data)
   220 #endif
   219 #endif
   221 {
   220 {
   222 	SDL_Thread *thread;
   221 	SDL_Thread *thread;
   251 
   250 
   252 	/* Add the thread to the list of available threads */
   251 	/* Add the thread to the list of available threads */
   253 	SDL_AddThread(thread);
   252 	SDL_AddThread(thread);
   254 
   253 
   255 	/* Create the thread and go! */
   254 	/* Create the thread and go! */
   256 #ifdef __OS2__
   255 #if defined(_WIN32) || defined(__OS2__)
   257         ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread);
   256 	ret = SDL_SYS_CreateThread(thread, args, pfnBeginThread, pfnEndThread);
   258 #else
   257 #else
   259 	ret = SDL_SYS_CreateThread(thread, args);
   258 	ret = SDL_SYS_CreateThread(thread, args);
   260 #endif
   259 #endif
   261 	if ( ret >= 0 ) {
   260 	if ( ret >= 0 ) {
   262 		/* Wait for the thread function to use arguments */
   261 		/* Wait for the thread function to use arguments */