summaryrefslogtreecommitdiffstats
path: root/uisimulator/sdl/kernel.c
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-04-12 15:38:56 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-04-12 15:38:56 +0000
commit9cde77060a05ed9b0dae8dffdb7f9ed77734bbf9 (patch)
tree21ffc08f9f2edfbda593c1954ac131ac4fe54230 /uisimulator/sdl/kernel.c
parent1b18dd0f179011d97d1d5e56724d0c454937c443 (diff)
downloadrockbox-9cde77060a05ed9b0dae8dffdb7f9ed77734bbf9.tar.gz
rockbox-9cde77060a05ed9b0dae8dffdb7f9ed77734bbf9.tar.bz2
rockbox-9cde77060a05ed9b0dae8dffdb7f9ed77734bbf9.zip
Patch 5107 from Steve Bavin, enable locking on sdl sim, now mutexes actually MUT EX on the SDL sim
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/kernel.c')
-rw-r--r--uisimulator/sdl/kernel.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/uisimulator/sdl/kernel.c b/uisimulator/sdl/kernel.c
index c17dc49dd6..b9ffe0eefe 100644
--- a/uisimulator/sdl/kernel.c
+++ b/uisimulator/sdl/kernel.c
@@ -150,18 +150,21 @@ int tick_remove_task(void (*f)(void))
return -1;
}
-/* TODO: Implement mutexes for win32 */
+/* Very simple mutex simulation - won't work with pre-emptive
+ multitasking, but is better than nothing at all */
void mutex_init(struct mutex *m)
{
- (void)m;
+ m->locked = false;
}
void mutex_lock(struct mutex *m)
{
- (void)m;
+ while(m->locked)
+ switch_thread();
+ m->locked = true;
}
void mutex_unlock(struct mutex *m)
{
- (void)m;
+ m->locked = false;
}