zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_thread.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef _SDL_thread_h
23 #define _SDL_thread_h
24 
31 #include "SDL_stdinc.h"
32 #include "SDL_error.h"
33 
34 /* Thread synchronization primitives */
35 #include "SDL_atomic.h"
36 #include "SDL_mutex.h"
37 
38 #include "begin_code.h"
39 /* Set up for C function definitions, even when using C++ */
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /* The SDL thread structure, defined in SDL_thread.c */
45 struct SDL_Thread;
46 typedef struct SDL_Thread SDL_Thread;
47 
48 /* The SDL thread ID */
49 typedef unsigned long SDL_threadID;
50 
51 /* Thread local storage ID, 0 is the invalid ID */
52 typedef unsigned int SDL_TLSID;
53 
59 typedef enum {
64 
69 typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
70 
71 #if defined(__WIN32__) && !defined(HAVE_LIBC)
72 
92 #define SDL_PASSED_BEGINTHREAD_ENDTHREAD
93 #include <process.h> /* This has _beginthread() and _endthread() defined! */
94 
95 typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned,
96  unsigned (__stdcall *
97  func) (void
98  *),
99  void *arg, unsigned,
100  unsigned *threadID);
101 typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code);
102 
107 SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data,
108  pfnSDL_CurrentBeginThread pfnBeginThread,
109  pfnSDL_CurrentEndThread pfnEndThread);
110 
114 #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex)
115 
116 #else
117 
137 SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
138 
139 #endif
140 
148 extern DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread);
149 
153 extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
154 
160 extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
161 
166 
174 
205 extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
206 
217 extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
218 
231 extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*));
232 
233 
234 /* Ends C function definitions when using C++ */
235 #ifdef __cplusplus
236 }
237 #endif
238 #include "close_code.h"
239 
240 #endif /* _SDL_thread_h */
241 
242 /* vi: set ts=4 sw=4 expandtab: */
DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void)
Definition: SDL_systhread.c:48
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
unsigned long SDL_threadID
Definition: SDL_thread.h:49
DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread *thread)
Definition: SDL_thread.c:370
DECLSPEC const char *SDLCALL SDL_GetThreadName(SDL_Thread *thread)
Definition: SDL_thread.c:383
DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void)
Create an identifier that is globally visible to all threads but refers to data that is thread-specif...
Definition: SDL_thread.c:32
#define DECLSPEC
Definition: begin_code.h:62
EGLImageKHR EGLint * name
Definition: eglext.h:284
#define SDLCALL
Definition: begin_code.h:72
GLenum func
Definition: SDL_opengl.h:5654
DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status)
Definition: SDL_thread.c:399
int
Definition: SDL_systhread.c:37
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
unsigned int uintptr_t
DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data)
static SDL_Thread * thread
Definition: inftrees.h:24
EGLSurface EGLint void ** value
Definition: eglext.h:301
DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void(*destructor)(void *))
Set the value associated with a thread local storage ID for the current thread.
Definition: SDL_thread.c:51
SDL_ThreadPriority
Definition: SDL_thread.h:59
DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority)
Definition: SDL_thread.c:393
DECLSPEC void *SDLCALL SDL_TLSGet(SDL_TLSID id)
Get the value associated with a thread local storage ID for the current thread.
Definition: SDL_thread.c:39
unsigned int SDL_TLSID
Definition: SDL_thread.h:52