thread topic
CategoryThread
SDL offers cross-platform thread management functions. These are mostly concerned with starting threads, setting their priority, and dealing with their termination.
In addition, there is support for Thread Local Storage (data that is unique to each thread, but accessed from a single key).
On platforms without thread support (such as Emscripten when built without pthreads), these functions still exist, but things like SDL_CreateThread() will report failure without doing anything.
If you're going to work with threads, you almost certainly need to have a good understanding of CategoryMutex as well.
Functions
-
sdlCleanupTls(
) → void thread - Cleanup all TLS data for this thread.
-
sdlCreateThread(
Pointer< threadNativeFunction< fn, String? name, Pointer<SdlThreadFunction> >NativeType> data) → Pointer<SdlThread> - Create a new thread with a default stack size.
-
sdlCreateThreadRuntime(
Pointer< threadNativeFunction< fn, String? name, Pointer<SdlThreadFunction> >NativeType> data, Pointer<NativeType> pfnBeginThread, Pointer<NativeType> pfnEndThread) → Pointer<SdlThread> - The actual entry point for SDL_CreateThread.
-
sdlCreateThreadWithProperties(
int props) → Pointer< threadSdlThread> - Create a new thread with with the specified properties.
-
sdlCreateThreadWithPropertiesRuntime(
int props, Pointer< threadNativeType> pfnBeginThread, Pointer<NativeType> pfnEndThread) → Pointer<SdlThread> - The actual entry point for SDL_CreateThreadWithProperties.
-
sdlDetachThread(
Pointer< threadSdlThread> thread) → void - Let a thread clean up on exit without intervention.
-
sdlGetCurrentThreadId(
) → int thread - Get the thread identifier for the current thread.
-
sdlGetThreadId(
Pointer< threadSdlThread> thread) → int - Get the thread identifier for the specified thread.
-
sdlGetThreadName(
Pointer< threadSdlThread> thread) → String? - Get the thread name as it was specified in SDL_CreateThread().
-
sdlGetThreadState(
Pointer< threadSdlThread> thread) → int - Get the current state of a thread.
-
sdlGetTls(
Pointer< threadSdlAtomicInt> id) → Pointer<NativeType> - Get the current thread's value associated with a thread local storage ID.
-
sdlSetCurrentThreadPriority(
int priority) → bool thread - Set the priority for the current thread.
-
sdlSetTls(
Pointer< threadSdlAtomicInt> id, Pointer<NativeType> value, Pointer<NativeType> deor) → bool - Set the current thread's value associated with a thread local storage ID.
-
sdlWaitThread(
Pointer< threadSdlThread> thread, Pointer<Int32> status) → void - Wait for a thread to finish.