Wiki Page Content

Differences between revisions 12 and 13
Revision 12 as of 2011-11-14 16:54:39
Size: 2578
Editor: SheenaSmith
Comment: add search exclusions for SG pages
Revision 13 as of 2011-12-29 18:10:47
Size: 1233
Editor: SheenaSmith
Comment: edit content; remove draft
Deletions are marked like this. Additions are marked like this.
Line 6: Line 6:
||<tablewidth="100%" style="color: #FF0000;" :> DRAFT||
Line 16: Line 15:

The SDL thread structure is defined in SDL_thread.c.<<BR>>
 . {{{typedef struct SDL_Thread SDL_Thread;}}}

<<Color2(green,Should SDL_thread.c be hyperlinked?)>>

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. <<Color2(green,Could this line and the next paragraph be joined and made a little less informal? Example: To solve this we will always use... -or- To solve this requires a little hack. We'll always use...)>>

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!

<<Color2(green,There is a lot of info in the header that looks like it might be code examples or coding info but is formatted more like complex defines. Does any of that belong here?)>>

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.

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

Functions


CategoryCategory

None: CategoryThread (last edited 2017-07-15 21:51:08 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit