SDL 3.0
SDL_thread.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2026 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
25/**
26 * # CategoryThread
27 *
28 * SDL offers cross-platform thread management functions. These are mostly
29 * concerned with starting threads, setting their priority, and dealing with
30 * their termination.
31 *
32 * In addition, there is support for Thread Local Storage (data that is unique
33 * to each thread, but accessed from a single key).
34 *
35 * On platforms without thread support (such as Emscripten when built without
36 * pthreads), these functions still exist, but things like SDL_CreateThread()
37 * will report failure without doing anything.
38 *
39 * If you're going to work with threads, you almost certainly need to have a
40 * good understanding of thread safety measures: locking and synchronization
41 * mechanisms are handled by the functions in SDL_mutex.h.
42 */
43
44#include <SDL3/SDL_stdinc.h>
45#include <SDL3/SDL_error.h>
46#include <SDL3/SDL_properties.h>
47
48/* Thread synchronization primitives */
49#include <SDL3/SDL_atomic.h>
50
51#if defined(SDL_PLATFORM_WINDOWS)
52#include <process.h> /* _beginthreadex() and _endthreadex() */
53#endif
54
55#include <SDL3/SDL_begin_code.h>
56/* Set up for C function definitions, even when using C++ */
57#ifdef __cplusplus
58extern "C" {
59#endif
60
61/**
62 * The SDL thread object.
63 *
64 * These are opaque data.
65 *
66 * \since This datatype is available since SDL 3.2.0.
67 *
68 * \sa SDL_CreateThread
69 * \sa SDL_WaitThread
70 */
71typedef struct SDL_Thread SDL_Thread;
72
73/**
74 * A unique numeric ID that identifies a thread.
75 *
76 * These are different from SDL_Thread objects, which are generally what an
77 * application will operate on, but having a way to uniquely identify a thread
78 * can be useful at times.
79 *
80 * \since This datatype is available since SDL 3.2.0.
81 *
82 * \sa SDL_GetThreadID
83 * \sa SDL_GetCurrentThreadID
84 */
86
87/**
88 * Thread local storage ID.
89 *
90 * 0 is the invalid ID. An app can create these and then set data for these
91 * IDs that is unique to each thread.
92 *
93 * \since This datatype is available since SDL 3.2.0.
94 *
95 * \sa SDL_GetTLS
96 * \sa SDL_SetTLS
97 */
99
100/**
101 * The SDL thread priority.
102 *
103 * SDL will make system changes as necessary in order to apply the thread
104 * priority. Code which attempts to control thread state related to priority
105 * should be aware that calling SDL_SetCurrentThreadPriority may alter such
106 * state. SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of
107 * this behavior.
108 *
109 * \since This enum is available since SDL 3.2.0.
110 */
117
118/**
119 * The SDL thread state.
120 *
121 * The current state of a thread can be checked by calling SDL_GetThreadState.
122 *
123 * \since This enum is available since SDL 3.2.0.
124 *
125 * \sa SDL_GetThreadState
126 */
127typedef enum SDL_ThreadState
128{
129 SDL_THREAD_UNKNOWN, /**< The thread is not valid */
130 SDL_THREAD_ALIVE, /**< The thread is currently running */
131 SDL_THREAD_DETACHED, /**< The thread is detached and can't be waited on */
132 SDL_THREAD_COMPLETE /**< The thread has finished and should be cleaned up with SDL_WaitThread() */
134
135/**
136 * The function passed to SDL_CreateThread() as the new thread's entry point.
137 *
138 * \param data what was passed as `data` to SDL_CreateThread().
139 * \returns a value that can be reported through SDL_WaitThread().
140 *
141 * \since This datatype is available since SDL 3.2.0.
142 */
143typedef int (SDLCALL *SDL_ThreadFunction) (void *data);
144
145
146#ifdef SDL_WIKI_DOCUMENTATION_SECTION
147
148/*
149 * Note that these aren't the correct function signatures in this block, but
150 * this is what the API reference manual should look like for all intents and
151 * purposes.
152 *
153 * Technical details, not for the wiki (hello, header readers!)...
154 *
155 * On Windows (and maybe other platforms), a program might use a different
156 * C runtime than its libraries. Or, in SDL's case, it might use a C runtime
157 * while SDL uses none at all.
158 *
159 * C runtimes expect to initialize thread-specific details when a new thread
160 * is created, but to do this in SDL_CreateThread would require SDL to know
161 * intimate details about the caller's C runtime, which is not possible.
162 *
163 * So SDL_CreateThread has two extra parameters, which are
164 * hidden at compile time by macros: the C runtime's `_beginthreadex` and
165 * `_endthreadex` entry points. If these are not NULL, they are used to spin
166 * and terminate the new thread; otherwise the standard Win32 `CreateThread`
167 * function is used. When `SDL_CreateThread` is called from a compiler that
168 * needs this C runtime thread init function, macros insert the appropriate
169 * function pointers for SDL_CreateThread's caller (which might be a different
170 * compiler with a different runtime in different calls to SDL_CreateThread!).
171 *
172 * SDL_BeginThreadFunction defaults to `_beginthreadex` on Windows (and NULL
173 * everywhere else), but apps that have extremely specific special needs can
174 * define this to something else and the SDL headers will use it, passing the
175 * app-defined value to SDL_CreateThread calls. Redefine this with caution!
176 *
177 * Platforms that don't need _beginthread stuff (most everything) will fail
178 * SDL_CreateThread with an error if these pointers _aren't_ NULL.
179 *
180 * Unless you are doing something extremely complicated, like perhaps a
181 * language binding, **you should never deal with this directly**. Let SDL's
182 * macros handle this platform-specific detail transparently!
183 */
184
185/**
186 * Create a new thread with a default stack size.
187 *
188 * This is a convenience function, equivalent to calling
189 * SDL_CreateThreadWithProperties with the following properties set:
190 *
191 * - `SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER`: `fn`
192 * - `SDL_PROP_THREAD_CREATE_NAME_STRING`: `name`
193 * - `SDL_PROP_THREAD_CREATE_USERDATA_POINTER`: `data`
194 *
195 * Note that this "function" is actually a macro that calls an internal
196 * function with two extra parameters not listed here; they are hidden through
197 * preprocessor macros and are needed to support various C runtimes at the
198 * point of the function call. Language bindings that aren't using the C
199 * headers will need to deal with this.
200 *
201 * Usually, apps should just call this function the same way on every platform
202 * and let the macros hide the details.
203 *
204 * \param fn the SDL_ThreadFunction function to call in the new thread.
205 * \param name the name of the thread.
206 * \param data a pointer that is passed to `fn`.
207 * \returns an opaque pointer to the new thread object on success, NULL if the
208 * new thread could not be created; call SDL_GetError() for more
209 * information.
210 *
211 * \threadsafety It is safe to call this function from any thread.
212 *
213 * \since This function is available since SDL 3.2.0.
214 *
215 * \sa SDL_CreateThreadWithProperties
216 * \sa SDL_WaitThread
217 */
218extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
219
220/**
221 * Create a new thread with with the specified properties.
222 *
223 * These are the supported properties:
224 *
225 * - `SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER`: an SDL_ThreadFunction
226 * value that will be called at the start of the new thread's life.
227 * Required.
228 * - `SDL_PROP_THREAD_CREATE_NAME_STRING`: the name of the new thread, which
229 * might be available to debuggers. Optional, defaults to NULL.
230 * - `SDL_PROP_THREAD_CREATE_USERDATA_POINTER`: an arbitrary app-defined
231 * pointer, which is passed to the entry function on the new thread, as its
232 * only parameter. Optional, defaults to NULL.
233 * - `SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER`: the size, in bytes, of the new
234 * thread's stack. Optional, defaults to 0 (system-defined default).
235 *
236 * SDL makes an attempt to report `SDL_PROP_THREAD_CREATE_NAME_STRING` to the
237 * system, so that debuggers can display it. Not all platforms support this.
238 *
239 * Thread naming is a little complicated: Most systems have very small limits
240 * for the string length (Haiku has 32 bytes, Linux currently has 16, Visual
241 * C++ 6.0 has _nine_!), and possibly other arbitrary rules. You'll have to
242 * see what happens with your system's debugger. The name should be UTF-8 (but
243 * using the naming limits of C identifiers is a better bet). There are no
244 * requirements for thread naming conventions, so long as the string is
245 * null-terminated UTF-8, but these guidelines are helpful in choosing a name:
246 *
247 * https://stackoverflow.com/questions/149932/naming-conventions-for-threads
248 *
249 * If a system imposes requirements, SDL will try to munge the string for it
250 * (truncate, etc), but the original string contents will be available from
251 * SDL_GetThreadName().
252 *
253 * The size (in bytes) of the new stack can be specified with
254 * `SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER`. Zero means "use the system
255 * default" which might be wildly different between platforms. x86 Linux
256 * generally defaults to eight megabytes, an embedded device might be a few
257 * kilobytes instead. You generally need to specify a stack that is a multiple
258 * of the system's page size (in many cases, this is 4 kilobytes, but check
259 * your system documentation).
260 *
261 * Note that this "function" is actually a macro that calls an internal
262 * function with two extra parameters not listed here; they are hidden through
263 * preprocessor macros and are needed to support various C runtimes at the
264 * point of the function call. Language bindings that aren't using the C
265 * headers will need to deal with this.
266 *
267 * The actual symbol in SDL is `SDL_CreateThreadWithPropertiesRuntime`, so
268 * there is no symbol clash, but trying to load an SDL shared library and look
269 * for "SDL_CreateThreadWithProperties" will fail.
270 *
271 * Usually, apps should just call this function the same way on every platform
272 * and let the macros hide the details.
273 *
274 * \param props the properties to use.
275 * \returns an opaque pointer to the new thread object on success, NULL if the
276 * new thread could not be created; call SDL_GetError() for more
277 * information.
278 *
279 * \threadsafety It is safe to call this function from any thread.
280 *
281 * \since This function is available since SDL 3.2.0.
282 *
283 * \sa SDL_CreateThread
284 * \sa SDL_WaitThread
285 */
286extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithProperties(SDL_PropertiesID props);
287
288#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "SDL.thread.create.entry_function"
289#define SDL_PROP_THREAD_CREATE_NAME_STRING "SDL.thread.create.name"
290#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "SDL.thread.create.userdata"
291#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "SDL.thread.create.stacksize"
292
293/* end wiki documentation for macros that are meant to look like functions. */
294#endif
295
296
297/* The real implementation, hidden from the wiki, so it can show this as real functions that don't have macro magic. */
298#ifndef SDL_WIKI_DOCUMENTATION_SECTION
299# if defined(SDL_PLATFORM_WINDOWS)
300# ifndef SDL_BeginThreadFunction
301# define SDL_BeginThreadFunction _beginthreadex
302# endif
303# ifndef SDL_EndThreadFunction
304# define SDL_EndThreadFunction _endthreadex
305# endif
306# endif
307#endif
308
309/* currently no other platforms than Windows use _beginthreadex/_endthreadex things. */
310#ifndef SDL_WIKI_DOCUMENTATION_SECTION
311# ifndef SDL_BeginThreadFunction
312# define SDL_BeginThreadFunction NULL
313# endif
314#endif
315
316#ifndef SDL_WIKI_DOCUMENTATION_SECTION
317# ifndef SDL_EndThreadFunction
318# define SDL_EndThreadFunction NULL
319# endif
320#endif
321
322#ifndef SDL_WIKI_DOCUMENTATION_SECTION
323/* These are the actual functions exported from SDL! Don't use them directly! Use the SDL_CreateThread and SDL_CreateThreadWithProperties macros! */
324/**
325 * The actual entry point for SDL_CreateThread.
326 *
327 * \param fn the SDL_ThreadFunction function to call in the new thread
328 * \param name the name of the thread
329 * \param data a pointer that is passed to `fn`
330 * \param pfnBeginThread the C runtime's _beginthreadex (or whatnot). Can be NULL.
331 * \param pfnEndThread the C runtime's _endthreadex (or whatnot). Can be NULL.
332 * \returns an opaque pointer to the new thread object on success, NULL if the
333 * new thread could not be created; call SDL_GetError() for more
334 * information.
335 *
336 * \threadsafety It is safe to call this function from any thread.
337 *
338 * \since This function is available since SDL 3.2.0.
339 */
340extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadRuntime(SDL_ThreadFunction fn, const char *name, void *data, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread);
341
342/**
343 * The actual entry point for SDL_CreateThreadWithProperties.
344 *
345 * \param props the properties to use
346 * \param pfnBeginThread the C runtime's _beginthreadex (or whatnot). Can be NULL.
347 * \param pfnEndThread the C runtime's _endthreadex (or whatnot). Can be NULL.
348 * \returns an opaque pointer to the new thread object on success, NULL if the
349 * new thread could not be created; call SDL_GetError() for more
350 * information.
351 *
352 * \threadsafety It is safe to call this function from any thread.
353 *
354 * \since This function is available since SDL 3.2.0.
355 */
356extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithPropertiesRuntime(SDL_PropertiesID props, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread);
357
358#define SDL_CreateThread(fn, name, data) SDL_CreateThreadRuntime((fn), (name), (data), (SDL_FunctionPointer) (SDL_BeginThreadFunction), (SDL_FunctionPointer) (SDL_EndThreadFunction))
359#define SDL_CreateThreadWithProperties(props) SDL_CreateThreadWithPropertiesRuntime((props), (SDL_FunctionPointer) (SDL_BeginThreadFunction), (SDL_FunctionPointer) (SDL_EndThreadFunction))
360#define SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER "SDL.thread.create.entry_function"
361#define SDL_PROP_THREAD_CREATE_NAME_STRING "SDL.thread.create.name"
362#define SDL_PROP_THREAD_CREATE_USERDATA_POINTER "SDL.thread.create.userdata"
363#define SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER "SDL.thread.create.stacksize"
364#endif
365
366
367/**
368 * Get the thread name as it was specified in SDL_CreateThread().
369 *
370 * \param thread the thread to query.
371 * \returns a pointer to a UTF-8 string that names the specified thread, or
372 * NULL if it doesn't have a name.
373 *
374 * \threadsafety It is safe to call this function from any thread.
375 *
376 * \since This function is available since SDL 3.2.0.
377 */
378extern SDL_DECLSPEC const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread);
379
380/**
381 * Get the thread identifier for the current thread.
382 *
383 * This thread identifier is as reported by the underlying operating system.
384 * If SDL is running on a platform that does not support threads the return
385 * value will always be zero.
386 *
387 * This function also returns a valid thread ID when called from the main
388 * thread.
389 *
390 * \returns the ID of the current thread.
391 *
392 * \threadsafety It is safe to call this function from any thread.
393 *
394 * \since This function is available since SDL 3.2.0.
395 *
396 * \sa SDL_GetThreadID
397 */
398extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetCurrentThreadID(void);
399
400/**
401 * Get the thread identifier for the specified thread.
402 *
403 * This thread identifier is as reported by the underlying operating system.
404 * If SDL is running on a platform that does not support threads the return
405 * value will always be zero.
406 *
407 * \param thread the thread to query.
408 * \returns the ID of the specified thread, or the ID of the current thread if
409 * `thread` is NULL.
410 *
411 * \threadsafety It is safe to call this function from any thread.
412 *
413 * \since This function is available since SDL 3.2.0.
414 *
415 * \sa SDL_GetCurrentThreadID
416 */
417extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetThreadID(SDL_Thread *thread);
418
419/**
420 * Set the priority for the current thread.
421 *
422 * Note that some platforms will not let you alter the priority (or at least,
423 * promote the thread to a higher priority) at all, and some require you to be
424 * an administrator account. Be prepared for this to fail.
425 *
426 * \param priority the SDL_ThreadPriority to set.
427 * \returns true on success or false on failure; call SDL_GetError() for more
428 * information.
429 *
430 * \threadsafety It is safe to call this function from any thread.
431 *
432 * \since This function is available since SDL 3.2.0.
433 */
434extern SDL_DECLSPEC bool SDLCALL SDL_SetCurrentThreadPriority(SDL_ThreadPriority priority);
435
436/**
437 * Wait for a thread to finish.
438 *
439 * Threads that haven't been detached will remain until this function cleans
440 * them up. Not doing so is a resource leak.
441 *
442 * Once a thread has been cleaned up through this function, the SDL_Thread
443 * that references it becomes invalid and should not be referenced again. As
444 * such, only one thread may call SDL_WaitThread() on another.
445 *
446 * The return code from the thread function is placed in the area pointed to
447 * by `status`, if `status` is not NULL.
448 *
449 * You may not wait on a thread that has been used in a call to
450 * SDL_DetachThread(). Use either that function or this one, but not both, or
451 * behavior is undefined.
452 *
453 * It is safe to pass a NULL thread to this function; it is a no-op.
454 *
455 * Note that the thread pointer is freed by this function and is not valid
456 * afterward.
457 *
458 * \param thread the SDL_Thread pointer that was returned from the
459 * SDL_CreateThread() call that started this thread.
460 * \param status a pointer filled in with the value returned from the thread
461 * function by its 'return', or -1 if the thread has been
462 * detached or isn't valid, may be NULL.
463 *
464 * \threadsafety It is safe to call this function from any thread, but only
465 * a single thread can wait any specific thread to finish.
466 *
467 * \since This function is available since SDL 3.2.0.
468 *
469 * \sa SDL_CreateThread
470 * \sa SDL_DetachThread
471 */
472extern SDL_DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
473
474/**
475 * Get the current state of a thread.
476 *
477 * \param thread the thread to query.
478 * \returns the current state of a thread, or SDL_THREAD_UNKNOWN if the thread
479 * isn't valid.
480 *
481 * \threadsafety It is safe to call this function from any thread.
482 *
483 * \since This function is available since SDL 3.2.0.
484 *
485 * \sa SDL_ThreadState
486 */
487extern SDL_DECLSPEC SDL_ThreadState SDLCALL SDL_GetThreadState(SDL_Thread *thread);
488
489/**
490 * Let a thread clean up on exit without intervention.
491 *
492 * A thread may be "detached" to signify that it should not remain until
493 * another thread has called SDL_WaitThread() on it. Detaching a thread is
494 * useful for long-running threads that nothing needs to synchronize with or
495 * further manage. When a detached thread is done, it simply goes away.
496 *
497 * There is no way to recover the return code of a detached thread. If you
498 * need this, don't detach the thread and instead use SDL_WaitThread().
499 *
500 * Once a thread is detached, you should usually assume the SDL_Thread isn't
501 * safe to reference again, as it will become invalid immediately upon the
502 * detached thread's exit, instead of remaining until someone has called
503 * SDL_WaitThread() to finally clean it up. As such, don't detach the same
504 * thread more than once.
505 *
506 * If a thread has already exited when passed to SDL_DetachThread(), it will
507 * stop waiting for a call to SDL_WaitThread() and clean up immediately. It is
508 * not safe to detach a thread that might be used with SDL_WaitThread().
509 *
510 * You may not call SDL_WaitThread() on a thread that has been detached. Use
511 * either that function or this one, but not both, or behavior is undefined.
512 *
513 * It is safe to pass NULL to this function; it is a no-op.
514 *
515 * \threadsafety It is safe to call this function from any thread.
516 *
517 * \param thread the SDL_Thread pointer that was returned from the
518 * SDL_CreateThread() call that started this thread.
519 *
520 * \since This function is available since SDL 3.2.0.
521 *
522 * \sa SDL_CreateThread
523 * \sa SDL_WaitThread
524 */
525extern SDL_DECLSPEC void SDLCALL SDL_DetachThread(SDL_Thread *thread);
526
527/**
528 * Get the current thread's value associated with a thread local storage ID.
529 *
530 * \param id a pointer to the thread local storage ID, may not be NULL.
531 * \returns the value associated with the ID for the current thread or NULL if
532 * no value has been set; call SDL_GetError() for more information.
533 *
534 * \threadsafety It is safe to call this function from any thread.
535 *
536 * \since This function is available since SDL 3.2.0.
537 *
538 * \sa SDL_SetTLS
539 */
540extern SDL_DECLSPEC void * SDLCALL SDL_GetTLS(SDL_TLSID *id);
541
542/**
543 * The callback used to cleanup data passed to SDL_SetTLS.
544 *
545 * This is called when a thread exits, to allow an app to free any resources.
546 *
547 * \param value a pointer previously handed to SDL_SetTLS.
548 *
549 * \since This datatype is available since SDL 3.2.0.
550 *
551 * \sa SDL_SetTLS
552 */
553typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value);
554
555/**
556 * Set the current thread's value associated with a thread local storage ID.
557 *
558 * If the thread local storage ID is not initialized (the value is 0), a new
559 * ID will be created in a thread-safe way, so all calls using a pointer to
560 * the same ID will refer to the same local storage.
561 *
562 * Note that replacing a value from a previous call to this function on the
563 * same thread does _not_ call the previous value's destructor!
564 *
565 * `destructor` can be NULL; it is assumed that `value` does not need to be
566 * cleaned up if so.
567 *
568 * \param id a pointer to the thread local storage ID, may not be NULL.
569 * \param value the value to associate with the ID for the current thread.
570 * \param destructor a function called when the thread exits, to free the
571 * value, may be NULL.
572 * \returns true on success or false on failure; call SDL_GetError() for more
573 * information.
574 *
575 * \threadsafety It is safe to call this function from any thread.
576 *
577 * \since This function is available since SDL 3.2.0.
578 *
579 * \sa SDL_GetTLS
580 */
581extern SDL_DECLSPEC bool SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor);
582
583/**
584 * Cleanup all TLS data for this thread.
585 *
586 * If you are creating your threads outside of SDL and then calling SDL
587 * functions, you should call this function before your thread exits, to
588 * properly clean up SDL memory.
589 *
590 * \threadsafety It is safe to call this function from any thread.
591 *
592 * \since This function is available since SDL 3.2.0.
593 */
594extern SDL_DECLSPEC void SDLCALL SDL_CleanupTLS(void);
595
596/* Ends C function definitions when using C++ */
597#ifdef __cplusplus
598}
599#endif
600#include <SDL3/SDL_close_code.h>
601
602#endif /* SDL_thread_h_ */
Uint32 SDL_PropertiesID
uint64_t Uint64
Definition SDL_stdinc.h:504
void(* SDL_FunctionPointer)(void)
SDL_ThreadState SDL_GetThreadState(SDL_Thread *thread)
SDL_ThreadID SDL_GetThreadID(SDL_Thread *thread)
#define SDL_CreateThreadWithProperties(props)
Definition SDL_thread.h:359
void SDL_DetachThread(SDL_Thread *thread)
SDL_ThreadState
Definition SDL_thread.h:128
@ SDL_THREAD_ALIVE
Definition SDL_thread.h:130
@ SDL_THREAD_COMPLETE
Definition SDL_thread.h:132
@ SDL_THREAD_UNKNOWN
Definition SDL_thread.h:129
@ SDL_THREAD_DETACHED
Definition SDL_thread.h:131
#define SDL_CreateThread(fn, name, data)
Definition SDL_thread.h:358
bool SDL_SetCurrentThreadPriority(SDL_ThreadPriority priority)
void SDL_CleanupTLS(void)
SDL_AtomicInt SDL_TLSID
Definition SDL_thread.h:98
bool SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor)
const char * SDL_GetThreadName(SDL_Thread *thread)
struct SDL_Thread SDL_Thread
Definition SDL_thread.h:71
void SDL_WaitThread(SDL_Thread *thread, int *status)
Uint64 SDL_ThreadID
Definition SDL_thread.h:85
SDL_ThreadPriority
Definition SDL_thread.h:111
@ SDL_THREAD_PRIORITY_TIME_CRITICAL
Definition SDL_thread.h:115
@ SDL_THREAD_PRIORITY_LOW
Definition SDL_thread.h:112
@ SDL_THREAD_PRIORITY_HIGH
Definition SDL_thread.h:114
@ SDL_THREAD_PRIORITY_NORMAL
Definition SDL_thread.h:113
void * SDL_GetTLS(SDL_TLSID *id)
void(* SDL_TLSDestructorCallback)(void *value)
Definition SDL_thread.h:553
SDL_ThreadID SDL_GetCurrentThreadID(void)
int(* SDL_ThreadFunction)(void *data)
Definition SDL_thread.h:143
SDL_Thread * SDL_CreateThreadRuntime(SDL_ThreadFunction fn, const char *name, void *data, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread)
SDL_Thread * SDL_CreateThreadWithPropertiesRuntime(SDL_PropertiesID props, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread)