FS#11793 - Implement threading support for PC

Attached to Project: Rockbox
Opened by Thomas Martitz (kugel.) - Sunday, 05 December 2010, 17:20 GMT
Last edited by Thomas Martitz (kugel.) - Friday, 18 February 2011, 22:48 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.7.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This patch adds load_/store_context for PC platforms to enable us to use our own threading library.

With this patch we can finally simulate our own cooperative threading in the simulator and get rid of the somewhat hacky SDL thread implementation.

For unix platforms I use make/swapcontext which is widely available; for win32 targets Fibers are used (available since win2k). The swapcontext implementation even allows us to check stack usage, although the stack usage on a PC is higher than on target so it might not be overly useful.

tools/configure probes swapcontext support and falls back to the SDL thread if it's not available; win32 builds always use the Fibers.

Tested with fuze simulator and mingw/wine so far.
This task depends upon

Closed by  Thomas Martitz (kugel.)
Friday, 18 February 2011, 22:48 GMT
Reason for closing:  Accepted
Additional comments about closing:  r29327, using a different mechanism on unix.