Fixed a bug in put_death_stack_and_reschedule(): release_sem_etc() was called

with the thread lock held, which might have caused a panic later on, if there
was another thread waiting for the death stack semaphore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13769 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-07-19 18:10:12 +00:00
parent 230a037ed4
commit f4a8c33b5c
+3 -1
View File
@@ -722,11 +722,13 @@ put_death_stack_and_reschedule(uint32 index)
disable_interrupts(); disable_interrupts();
GRAB_THREAD_LOCK(); GRAB_THREAD_LOCK();
sDeathStackBitmap &= ~(1 << index); sDeathStackBitmap &= ~(1 << index);
RELEASE_THREAD_LOCK();
release_sem_etc(sDeathStackSem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(sDeathStackSem, 1, B_DO_NOT_RESCHEDULE);
// we must not have acquired the thread lock when releasing a semaphore
GRAB_THREAD_LOCK();
scheduler_reschedule(); scheduler_reschedule();
// requires thread lock to be held // requires thread lock to be held
} }