annotate touchTest/Iphone Test/touchTestIPhone2/touchTestIPhone/include/SDL_thread.h @ 4691:73f5c530afac

Fixed hgIgnore to ignore test/gesturetest
author Jim Grandpre <jim.tla@gmail.com>
date Thu, 19 Aug 2010 13:49:11 -0400
parents 31607094315c
children
rev   line source
4677
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
1 /*
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
4
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
7 License as published by the Free Software Foundation; either
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
9
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
13 Lesser General Public License for more details.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
14
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
18
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
19 Sam Lantinga
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
20 slouken@libsdl.org
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
21 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
22
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
23 #ifndef _SDL_thread_h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
24 #define _SDL_thread_h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
25
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
26 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
27 * \file SDL_thread.h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
28 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
29 * Header for the SDL thread management routines.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
30 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
31
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
32 #include "SDL_stdinc.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
33 #include "SDL_error.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
34
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
35 /* Thread synchronization primitives */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
36 #include "SDL_mutex.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
37
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
38 #include "begin_code.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
39 /* Set up for C function definitions, even when using C++ */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
40 #ifdef __cplusplus
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
41 /* *INDENT-OFF* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
42 extern "C" {
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
43 /* *INDENT-ON* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
44 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
45
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
46 /* The SDL thread structure, defined in SDL_thread.c */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
47 struct SDL_Thread;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
48 typedef struct SDL_Thread SDL_Thread;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
49
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
50 /* The SDL thread ID */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
51 typedef unsigned long SDL_threadID;
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
52
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
53 #if defined(__WIN32__) && !defined(HAVE_LIBC)
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
54 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
55 * \file SDL_thread.h
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
56 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
57 * We compile SDL into a DLL. This means, that it's the DLL which
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
58 * creates a new thread for the calling process with the SDL_CreateThread()
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
59 * API. There is a problem with this, that only the RTL of the SDL.DLL will
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
60 * be initialized for those threads, and not the RTL of the calling
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
61 * application!
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
62 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
63 * To solve this, we make a little hack here.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
64 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
65 * We'll always use the caller's _beginthread() and _endthread() APIs to
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
66 * start a new thread. This way, if it's the SDL.DLL which uses this API,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
67 * then the RTL of SDL.DLL will be used to create the new thread, and if it's
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
68 * the application, then the RTL of the application will be used.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
69 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
70 * So, in short:
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
71 * Always use the _beginthread() and _endthread() of the calling runtime
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
72 * library!
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
73 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
74 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
75 #ifndef _WIN32_WCE
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
76 #include <process.h> /* This has _beginthread() and _endthread() defined! */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
77 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
78
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
79 #ifdef __GNUC__
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
80 typedef unsigned long (__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
81 unsigned
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
82 (__stdcall *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
83 func) (void *),
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
84 void *arg,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
85 unsigned,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
86 unsigned
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
87 *threadID);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
88 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
89 #else
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
90 typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
91 unsigned (__stdcall *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
92 func) (void
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
93 *),
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
94 void *arg, unsigned,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
95 unsigned *threadID);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
96 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
97 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
98
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
99 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
100 * Create a thread.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
101 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
102 extern DECLSPEC SDL_Thread *SDLCALL
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
103 SDL_CreateThread(int (SDLCALL * f) (void *), void *data,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
104 pfnSDL_CurrentBeginThread pfnBeginThread,
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
105 pfnSDL_CurrentEndThread pfnEndThread);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
106
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
107 #if defined(_WIN32_WCE)
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
108
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
109 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
110 * Create a thread.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
111 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
112 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
113
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
114 #else
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
115
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
116 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
117 * Create a thread.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
118 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
119 #define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
120
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
121 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
122 #else
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
123
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
124 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
125 * Create a thread.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
126 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
127 extern DECLSPEC SDL_Thread *SDLCALL
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
128 SDL_CreateThread(int (SDLCALL * fn) (void *), void *data);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
129
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
130 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
131
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
132 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
133 * Get the thread identifier for the current thread.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
134 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
135 extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
136
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
137 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
138 * Get the thread identifier for the specified thread.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
139 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
140 * Equivalent to SDL_ThreadID() if the specified thread is NULL.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
141 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
142 extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
143
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
144 /**
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
145 * Wait for a thread to finish.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
146 *
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
147 * The return code for the thread function is placed in the area
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
148 * pointed to by \c status, if \c status is not NULL.
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
149 */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
150 extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
151
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
152
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
153 /* Ends C function definitions when using C++ */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
154 #ifdef __cplusplus
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
155 /* *INDENT-OFF* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
156 }
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
157 /* *INDENT-ON* */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
158 #endif
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
159 #include "close_code.h"
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
160
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
161 #endif /* _SDL_thread_h */
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
162
31607094315c Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
diff changeset
163 /* vi: set ts=4 sw=4 expandtab: */