summaryrefslogtreecommitdiff
path: root/uisimulator/sdl/thread-sdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/sdl/thread-sdl.c')
-rw-r--r--uisimulator/sdl/thread-sdl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/uisimulator/sdl/thread-sdl.c b/uisimulator/sdl/thread-sdl.c
index 78a66f72a7..5aae9a4bf8 100644
--- a/uisimulator/sdl/thread-sdl.c
+++ b/uisimulator/sdl/thread-sdl.c
@@ -246,7 +246,7 @@ void switch_thread(void)
246{ 246{
247 struct thread_entry *current = cores[CURRENT_CORE].running; 247 struct thread_entry *current = cores[CURRENT_CORE].running;
248 248
249 set_irq_level(0); 249 enable_irq();
250 250
251 switch (current->state) 251 switch (current->state)
252 { 252 {
@@ -266,9 +266,9 @@ void switch_thread(void)
266 SDL_SemWait(current->context.s); 266 SDL_SemWait(current->context.s);
267 SDL_LockMutex(m); 267 SDL_LockMutex(m);
268 268
269 oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 269 oldlevel = disable_irq_save();
270 current->state = STATE_RUNNING; 270 current->state = STATE_RUNNING;
271 set_irq_level(oldlevel); 271 restore_irq(oldlevel);
272 break; 272 break;
273 } /* STATE_BLOCKED: */ 273 } /* STATE_BLOCKED: */
274 274
@@ -280,7 +280,7 @@ void switch_thread(void)
280 result = SDL_SemWaitTimeout(current->context.s, current->tmo_tick); 280 result = SDL_SemWaitTimeout(current->context.s, current->tmo_tick);
281 SDL_LockMutex(m); 281 SDL_LockMutex(m);
282 282
283 oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 283 oldlevel = disable_irq_save();
284 284
285 if (current->state == STATE_BLOCKED_W_TMO) 285 if (current->state == STATE_BLOCKED_W_TMO)
286 { 286 {
@@ -303,7 +303,7 @@ void switch_thread(void)
303 SDL_SemTryWait(current->context.s); 303 SDL_SemTryWait(current->context.s);
304 } 304 }
305 305
306 set_irq_level(oldlevel); 306 restore_irq(oldlevel);
307 break; 307 break;
308 } /* STATE_BLOCKED_W_TMO: */ 308 } /* STATE_BLOCKED_W_TMO: */
309 309
@@ -505,7 +505,7 @@ void remove_thread(struct thread_entry *thread)
505 SDL_Thread *t; 505 SDL_Thread *t;
506 SDL_sem *s; 506 SDL_sem *s;
507 507
508 int oldlevel = set_irq_level(HIGHEST_IRQ_LEVEL); 508 int oldlevel = disable_irq_save();
509 509
510 if (thread == NULL) 510 if (thread == NULL)
511 { 511 {
@@ -547,12 +547,12 @@ void remove_thread(struct thread_entry *thread)
547 { 547 {
548 /* Do a graceful exit - perform the longjmp back into the thread 548 /* Do a graceful exit - perform the longjmp back into the thread
549 function to return */ 549 function to return */
550 set_irq_level(oldlevel); 550 restore_irq(oldlevel);
551 longjmp(thread_jmpbufs[current - threads], 1); 551 longjmp(thread_jmpbufs[current - threads], 1);
552 } 552 }
553 553
554 SDL_KillThread(t); 554 SDL_KillThread(t);
555 set_irq_level(oldlevel); 555 restore_irq(oldlevel);
556} 556}
557 557
558void thread_exit(void) 558void thread_exit(void)