summaryrefslogtreecommitdiff
path: root/firmware/thread.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-02-18 22:46:01 +0000
committerThomas Martitz <kugel@rockbox.org>2011-02-18 22:46:01 +0000
commit6d85de341928aef8178465c60122f3cbe76f5dd6 (patch)
treeff86c384a574ac20d3418c1b904ed4d0de1f6980 /firmware/thread.c
parent3926c30705cc7235122e2f2e35ab506b53238cdf (diff)
downloadrockbox-6d85de341928aef8178465c60122f3cbe76f5dd6.zip
rockbox-6d85de341928aef8178465c60122f3cbe76f5dd6.tar.gz
rockbox-6d85de341928aef8178465c60122f3cbe76f5dd6.tar.bz2
rockbox-6d85de341928aef8178465c60122f3cbe76f5dd6.tar.xz
Implement cooperative threads on hosted platforms using C code.
This replaces SDL threads with real cooperative threads, which are less cpu intensive and allow priority scheduling. The backend for context switching is dependant on the host (sigaltstack/longjmp on Unix, Fibers on Windows). configure has options to force or disallow SDL threads. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29327 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/thread.c')
-rw-r--r--firmware/thread.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index b71bc17..a81f56c 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -174,10 +174,13 @@ void switch_thread(void)
__attribute__((noinline));
/****************************************************************************
- * Processor-specific section - include necessary core support
+ * Processor/OS-specific section - include necessary core support
*/
-#if defined(ANDROID)
-#include "thread-android-arm.c"
+
+#if defined(HAVE_WIN32_FIBER_THREADS)
+#include "thread-win32.c"
+#elif defined(HAVE_SIGALTSTACK_THREADS)
+#include "thread-unix.c"
#elif defined(CPU_ARM)
#include "thread-arm.c"
#if defined (CPU_PP)
@@ -2308,6 +2311,9 @@ void init_threads(void)
thread_exit();
#endif /* NUM_CORES */
}
+#ifdef INIT_MAIN_THREAD
+ init_main_thread(&thread->context);
+#endif
}
/* Shared stack scan helper for thread_stack_usage and idle_stack_usage */