summaryrefslogtreecommitdiffstats
path: root/uisimulator/sdl/thread-sdl.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-12-03 14:01:12 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-12-03 14:01:12 +0000
commita4d19b7e899a9223433fcb91627af737a638e9d3 (patch)
treec3ca7e9782f7029ca0226969c1e402f20d4fa444 /uisimulator/sdl/thread-sdl.c
parent08533e7f37f9bd97a5653b137a179111f37d63f6 (diff)
downloadrockbox-a4d19b7e899a9223433fcb91627af737a638e9d3.tar.gz
rockbox-a4d19b7e899a9223433fcb91627af737a638e9d3.tar.bz2
rockbox-a4d19b7e899a9223433fcb91627af737a638e9d3.zip
Simplify the uisimulator I/O routine and let the rockbox thread calling the functions be the background thread. Should speed things up too and lose none of the advantanges of background I/O.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15870 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/thread-sdl.c')
-rw-r--r--uisimulator/sdl/thread-sdl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/uisimulator/sdl/thread-sdl.c b/uisimulator/sdl/thread-sdl.c
index a07ac29738..b8297072f2 100644
--- a/uisimulator/sdl/thread-sdl.c
+++ b/uisimulator/sdl/thread-sdl.c
@@ -157,6 +157,23 @@ bool thread_sdl_init(void *param)
return true;
}
+/* A way to yield and leave the threading system for extended periods */
+void thread_sdl_thread_lock(void *me)
+{
+ SDL_LockMutex(m);
+ running = (struct thread_entry *)me;
+
+ if (threads_exit)
+ remove_thread(NULL);
+}
+
+void * thread_sdl_thread_unlock(void)
+{
+ struct thread_entry *current = running;
+ SDL_UnlockMutex(m);
+ return current;
+}
+
static int find_empty_thread_slot(void)
{
int n;