diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2008-03-26 01:50:41 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2008-03-26 01:50:41 +0000 |
| commit | af395f4db6ad7b83f9d9afefb1c0ceeedd140a45 (patch) | |
| tree | b631289b4a3b28d3c65b10d272d50298f377c69f /uisimulator/sdl/thread-sdl.c | |
| parent | 74d678fdbcbc427c057e7682ba0a0566e49a8b97 (diff) | |
| download | rockbox-af395f4db6ad7b83f9d9afefb1c0ceeedd140a45.zip rockbox-af395f4db6ad7b83f9d9afefb1c0ceeedd140a45.tar.gz rockbox-af395f4db6ad7b83f9d9afefb1c0ceeedd140a45.tar.bz2 rockbox-af395f4db6ad7b83f9d9afefb1c0ceeedd140a45.tar.xz | |
Do core interrupt masking in a less general fashion and save some instructions to decrease size and speed things up a little bit. Small fix to a few places where interrupts would get enabled again where they shouldn't have been (context switching calls when disabled).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16811 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator/sdl/thread-sdl.c')
| -rw-r--r-- | uisimulator/sdl/thread-sdl.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/uisimulator/sdl/thread-sdl.c b/uisimulator/sdl/thread-sdl.c index 78a66f7..5aae9a4 100644 --- a/uisimulator/sdl/thread-sdl.c +++ b/uisimulator/sdl/thread-sdl.c @@ -246,7 +246,7 @@ void switch_thread(void) { struct thread_entry *current = cores[CURRENT_CORE].running; - set_irq_level(0); + enable_irq(); switch (current->state) { @@ -266,9 +266,9 @@ void switch_thread(void) SDL_SemWait(current->context.s); SDL_LockMutex(m); - oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); + oldlevel = disable_irq_save(); current->state = STATE_RUNNING; - set_irq_level(oldlevel); + restore_irq(oldlevel); break; } /* STATE_BLOCKED: */ @@ -280,7 +280,7 @@ void switch_thread(void) result = SDL_SemWaitTimeout(current->context.s, current->tmo_tick); SDL_LockMutex(m); - oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); + oldlevel = disable_irq_save(); if (current->state == STATE_BLOCKED_W_TMO) { @@ -303,7 +303,7 @@ void switch_thread(void) SDL_SemTryWait(current->context.s); } - set_irq_level(oldlevel); + restore_irq(oldlevel); break; } /* STATE_BLOCKED_W_TMO: */ @@ -505,7 +505,7 @@ void remove_thread(struct thread_entry *thread) SDL_Thread *t; SDL_sem *s; - int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); + int oldlevel = disable_irq_save(); if (thread == NULL) { @@ -547,12 +547,12 @@ void remove_thread(struct thread_entry *thread) { /* Do a graceful exit - perform the longjmp back into the thread function to return */ - set_irq_level(oldlevel); + restore_irq(oldlevel); longjmp(thread_jmpbufs[current - threads], 1); } SDL_KillThread(t); - set_irq_level(oldlevel); + restore_irq(oldlevel); } void thread_exit(void) |