|
Size: 2359
Comment: update content for consistency - intro description
|
Size: 2578
Comment: add search exclusions for SG pages
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 36: | Line 36: |
| <<FullSearch(category:CategoryEnum CategoryThread)>> | <<FullSearch(category:CategoryEnum CategoryThread -SGEnumerations)>> ##Remove this line and the ## below to use this markup if it becomes relevant to this category ##== Structures == ##<<FullSearch(category:CategoryStruct CategoryThread -SGStructures)>> |
| Line 39: | Line 43: |
| <<FullSearch(category:CategoryThread -CategoryEnum -CategoryStruct)>> | <<FullSearch(category:CategoryThread -CategoryEnum -CategoryStruct -SGFunctions)>> |
DRAFT |
Thread Management
Include File(s): SDL_thread.h, SDL_mutex.h (contains thread synchronization primitives)
Introduction
This category contains functions for system independent thread management routines.
The SDL thread structure is defined in SDL_thread.c.
typedef struct SDL_Thread SDL_Thread;
green
We compile SDL into a DLL. This means that it's the DLL which creates a new thread for the calling process with the SDL_CreateThread() API. There is a problem with this, that only the RTL of the SDL.DLL will be initialized for those threads, and not the RTL of the calling application!
To solve this, we make a little hack here. green
We'll always use the caller's _beginthread() and _endthread() APIs to start a new thread. This way, if it's the SDL.DLL which uses this API, then the RTL of SDL.DLL will be used to create the new thread, and if it's the application, then the RTL of the application will be used.
So, in short: Always use the _beginthread() and _endthread() of the calling runtime library!
green
NOTE: You should not expect to be able to create a window, render, or receive events on any thread other than the main one. For platform-specific exceptions or complicated options ask on the mailing list or forum.
Enumerations
