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:
parent
0555803a41
commit
032ff97fbd
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user