diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-01-18 13:12:33 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-01-18 13:12:33 +0000 |
commit | 6a8379674c43103c008f841968b84287b8fdaf89 (patch) | |
tree | 39003a711cfff5cdf5ad00a56c70ae34f34d5100 /uisimulator | |
parent | 3b36b98ff8dea187bd6c25174978da4f7b5e3231 (diff) | |
download | rockbox-6a8379674c43103c008f841968b84287b8fdaf89.tar.gz rockbox-6a8379674c43103c008f841968b84287b8fdaf89.zip |
Finally, out goes struct spinlock for anything but mutiprocessor targets where it becomes a reenterable corelock.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/sdl/kernel.c | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/uisimulator/sdl/kernel.c b/uisimulator/sdl/kernel.c index 7126b82072..17ca55a694 100644 --- a/uisimulator/sdl/kernel.c +++ b/uisimulator/sdl/kernel.c @@ -597,7 +597,7 @@ void mutex_unlock(struct mutex *m) /* unlocker not being the owner is an unlocking violation */ if(m->thread != thread_get_current()) { - fprintf(stderr, "spinlock_unlock->wrong thread"); + fprintf(stderr, "mutex_unlock->wrong thread"); exit(-1); } @@ -617,52 +617,6 @@ void mutex_unlock(struct mutex *m) } } -void spinlock_init(struct spinlock *l) -{ - l->locked = 0; - l->thread = NULL; - l->count = 0; -} - -void spinlock_lock(struct spinlock *l) -{ - struct thread_entry *const thread = thread_get_current(); - - if (l->thread == thread) - { - l->count++; - return; - } - - while(test_and_set(&l->locked, 1)) - { - switch_thread(NULL); - } - - l->thread = thread; -} - -void spinlock_unlock(struct spinlock *l) -{ - /* unlocker not being the owner is an unlocking violation */ - if(l->thread != thread_get_current()) - { - fprintf(stderr, "spinlock_unlock->wrong thread"); - exit(-1); - } - - if (l->count > 0) - { - /* this thread still owns lock */ - l->count--; - return; - } - - /* clear owner */ - l->thread = NULL; - l->locked = 0; -} - #ifdef HAVE_SEMAPHORE_OBJECTS void semaphore_init(struct semaphore *s, int max, int start) { |