comparison include/SDL_thread.h @ 4217:4c4113c2162c SDL-1.2

Fixed bug #706 Ken Bull 2009-02-25 13:22:02 PST Adds Doxygen support for all headers (except config and boilerplate headers) in the include folder for SDL-1.2 revision 4446. While in general SDL is quite thoroughly commented, none of these comments are correctly formatted for Doxygen and are generally inconsistent in their formatting.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 21 Sep 2009 09:38:10 +0000
parents a1b03ba2fcd0
children
comparison
equal deleted inserted replaced
4216:5b99971a27b4 4217:4c4113c2162c
21 */ 21 */
22 22
23 #ifndef _SDL_thread_h 23 #ifndef _SDL_thread_h
24 #define _SDL_thread_h 24 #define _SDL_thread_h
25 25
26 /* Header for the SDL thread management routines 26 /** @file SDL_thread.h
27 27 * Header for the SDL thread management routines
28 These are independent of the other SDL routines. 28 *
29 */ 29 * @note These are independent of the other SDL routines.
30 */
30 31
31 #include "SDL_stdinc.h" 32 #include "SDL_stdinc.h"
32 #include "SDL_error.h" 33 #include "SDL_error.h"
33 34
34 /* Thread synchronization primitives */ 35 /* Thread synchronization primitives */
38 /* Set up for C function definitions, even when using C++ */ 39 /* Set up for C function definitions, even when using C++ */
39 #ifdef __cplusplus 40 #ifdef __cplusplus
40 extern "C" { 41 extern "C" {
41 #endif 42 #endif
42 43
43 /* The SDL thread structure, defined in SDL_thread.c */ 44 /** The SDL thread structure, defined in SDL_thread.c */
44 struct SDL_Thread; 45 struct SDL_Thread;
45 typedef struct SDL_Thread SDL_Thread; 46 typedef struct SDL_Thread SDL_Thread;
46 47
47 /* Create a thread */ 48 /** Create a thread */
48 #if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__) 49 #if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
49 /* 50 /**
50 We compile SDL into a DLL on OS/2. This means, that it's the DLL which 51 * We compile SDL into a DLL on OS/2. This means, that it's the DLL which
51 creates a new thread for the calling process with the SDL_CreateThread() 52 * creates a new thread for the calling process with the SDL_CreateThread()
52 API. There is a problem with this, that only the RTL of the SDL.DLL will 53 * API. There is a problem with this, that only the RTL of the SDL.DLL will
53 be initialized for those threads, and not the RTL of the calling application! 54 * be initialized for those threads, and not the RTL of the calling application!
54 To solve this, we make a little hack here. 55 * To solve this, we make a little hack here.
55 We'll always use the caller's _beginthread() and _endthread() APIs to 56 * We'll always use the caller's _beginthread() and _endthread() APIs to
56 start a new thread. This way, if it's the SDL.DLL which uses this API, 57 * start a new thread. This way, if it's the SDL.DLL which uses this API,
57 then the RTL of SDL.DLL will be used to create the new thread, and if it's 58 * then the RTL of SDL.DLL will be used to create the new thread, and if it's
58 the application, then the RTL of the application will be used. 59 * the application, then the RTL of the application will be used.
59 So, in short: 60 * So, in short:
60 Always use the _beginthread() and _endthread() of the calling runtime library! 61 * Always use the _beginthread() and _endthread() of the calling runtime library!
61 */ 62 */
62 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD 63 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
63 #ifndef _WIN32_WCE 64 #ifndef _WIN32_WCE
64 #include <process.h> /* This has _beginthread() and _endthread() defined! */ 65 #include <process.h> /* This has _beginthread() and _endthread() defined! */
65 #endif 66 #endif
66 67
90 #endif 91 #endif
91 #else 92 #else
92 extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data); 93 extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
93 #endif 94 #endif
94 95
95 /* Get the 32-bit thread identifier for the current thread */ 96 /** Get the 32-bit thread identifier for the current thread */
96 extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void); 97 extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
97 98
98 /* Get the 32-bit thread identifier for the specified thread, 99 /** Get the 32-bit thread identifier for the specified thread,
99 equivalent to SDL_ThreadID() if the specified thread is NULL. 100 * equivalent to SDL_ThreadID() if the specified thread is NULL.
100 */ 101 */
101 extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread); 102 extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
102 103
103 /* Wait for a thread to finish. 104 /** Wait for a thread to finish.
104 The return code for the thread function is placed in the area 105 * The return code for the thread function is placed in the area
105 pointed to by 'status', if 'status' is not NULL. 106 * pointed to by 'status', if 'status' is not NULL.
106 */ 107 */
107 extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status); 108 extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
108 109
109 /* Forcefully kill a thread without worrying about its state */ 110 /** Forcefully kill a thread without worrying about its state */
110 extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread); 111 extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
111 112
112 113
113 /* Ends C function definitions when using C++ */ 114 /* Ends C function definitions when using C++ */
114 #ifdef __cplusplus 115 #ifdef __cplusplus