# 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](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 thread safety measures: locking and synchronization
mechanisms are handled by the functions in [SDL_mutex](SDL_mutex).h.

<!-- END CATEGORY DOCUMENTATION -->

You can read about the SDL_mutex.h pieces on the wiki in [CategoryMutex](CategoryMutex).

## Functions

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryThread, CategoryAPIFunction -->
- [SDL_CleanupTLS](SDL_CleanupTLS)
- [SDL_CreateThread](SDL_CreateThread)
- [SDL_CreateThreadWithProperties](SDL_CreateThreadWithProperties)
- [SDL_DetachThread](SDL_DetachThread)
- [SDL_GetCurrentThreadID](SDL_GetCurrentThreadID)
- [SDL_GetThreadID](SDL_GetThreadID)
- [SDL_GetThreadName](SDL_GetThreadName)
- [SDL_GetThreadState](SDL_GetThreadState)
- [SDL_GetTLS](SDL_GetTLS)
- [SDL_SetCurrentThreadPriority](SDL_SetCurrentThreadPriority)
- [SDL_SetTLS](SDL_SetTLS)
- [SDL_WaitThread](SDL_WaitThread)
<!-- END CATEGORY LIST -->

## Datatypes

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryThread, CategoryAPIDatatype -->
- [SDL_Thread](SDL_Thread)
- [SDL_ThreadFunction](SDL_ThreadFunction)
- [SDL_ThreadID](SDL_ThreadID)
- [SDL_TLSDestructorCallback](SDL_TLSDestructorCallback)
- [SDL_TLSID](SDL_TLSID)
<!-- END CATEGORY LIST -->

## Structs

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryThread, CategoryAPIStruct -->
- (none.)
<!-- END CATEGORY LIST -->

## Enums

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryThread, CategoryAPIEnum -->
- [SDL_ThreadPriority](SDL_ThreadPriority)
- [SDL_ThreadState](SDL_ThreadState)
<!-- END CATEGORY LIST -->

## Macros

<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. -->
<!-- BEGIN CATEGORY LIST: CategoryThread, CategoryAPIMacro -->
- (none.)
<!-- END CATEGORY LIST -->


----
[CategoryAPICategory](CategoryAPICategory)

