00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SDL_thread_h
00024 #define _SDL_thread_h
00025
00032 #include "SDL_stdinc.h"
00033 #include "SDL_error.h"
00034
00035
00036 #include "SDL_mutex.h"
00037
00038 #include "begin_code.h"
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00045 struct SDL_Thread;
00046 typedef struct SDL_Thread SDL_Thread;
00047
00049 #if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
00050
00063 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
00064 #ifndef _WIN32_WCE
00065 #include <process.h>
00066 #endif
00067
00068 #ifdef __OS2__
00069 typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
00070 typedef void (*pfnSDL_CurrentEndThread)(void);
00071 #elif __GNUC__
00072 typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
00073 unsigned (__stdcall *func)(void *), void *arg,
00074 unsigned, unsigned *threadID);
00075 typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
00076 #else
00077 typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
00078 unsigned (__stdcall *func)(void *), void *arg,
00079 unsigned, unsigned *threadID);
00080 typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
00081 #endif
00082
00083 extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
00084
00085 #ifdef __OS2__
00086 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
00087 #elif defined(_WIN32_WCE)
00088 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
00089 #else
00090 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
00091 #endif
00092 #else
00093 extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
00094 #endif
00095
00097 extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
00098
00102 extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
00103
00108 extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
00109
00111 extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
00112
00113
00114
00115 #ifdef __cplusplus
00116 }
00117 #endif
00118 #include "close_code.h"
00119
00120 #endif