From 1b0e74fc1884bb49d4aed74395abc120d98f89fc Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 26 Jan 2008 18:17:12 +0000 Subject: [PATCH] Don't clobber the thread variable as we use it again. Since it always is NULL at the end of that loop we guaranteed a crash when this special handling was triggered. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23748 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/sem.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/sem.cpp b/src/system/kernel/sem.cpp index 4466446a0a..e93e05fff0 100644 --- a/src/system/kernel/sem.cpp +++ b/src/system/kernel/sem.cpp @@ -938,8 +938,10 @@ switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count, B_INTERRUPTED, true); } RELEASE_SEM_LOCK(sSems[slot]); - while ((thread = thread_dequeue(&wakeupQueue)) != NULL) - scheduler_enqueue_in_run_queue(thread); + + struct thread *wakeupThread; + while ((wakeupThread = thread_dequeue(&wakeupQueue)) != NULL) + scheduler_enqueue_in_run_queue(wakeupThread); // fall through and reschedule since another thread with a higher priority may have been woken up }