When a thread times out on a locking primitive, reschedule only, if the

timed out thread has a higher priority than the currently running one.
Maybe we should even restrict this behavior to realtime threads.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27897 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-10-06 23:00:17 +00:00
parent 0555803a41
commit 032ff97fbd

View File

@ -2186,8 +2186,14 @@ thread_block_timeout(timer* timer)
// easy.
struct thread* thread = (struct thread*)timer->user_data;
if (thread_unblock_locked(thread, B_TIMED_OUT))
return B_INVOKE_SCHEDULER;
if (thread_unblock_locked(thread, B_TIMED_OUT)) {
// We actually woke up the thread. If it has a higher priority than the
// currently running thread, we invoke the scheduler.
// TODO: Is this really such a good idea or should we do that only when
// the woken up thread has realtime priority?
if (thread->priority > thread_get_current_thread()->priority)
return B_INVOKE_SCHEDULER;
}
return B_HANDLED_INTERRUPT;
}