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
This commit is contained in:
parent
1b18dd0f17
commit
9cde77060a
2 changed files with 8 additions and 4 deletions
|
@ -197,3 +197,4 @@ Rani Hod
|
|||
Tom Ross
|
||||
Anton Romanov
|
||||
Jean-Luc Ohl
|
||||
Steve Bavin
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue