Kernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on.
This commit is contained in:
parent
cef5f45de2
commit
fd95b6ee26
4 changed files with 22 additions and 21 deletions
|
@ -55,10 +55,16 @@ SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
|
|||
if (ShouldWait(thread.get()))
|
||||
continue;
|
||||
|
||||
bool ready_to_run = std::none_of(thread->wait_objects.begin(), thread->wait_objects.end(),
|
||||
// A thread is ready to run if it's either in THREADSTATUS_WAIT_SYNCH_ANY or
|
||||
// in THREADSTATUS_WAIT_SYNCH_ALL and the rest of the objects it is waiting on are ready.
|
||||
bool ready_to_run = true;
|
||||
if (thread->status == THREADSTATUS_WAIT_SYNCH_ALL) {
|
||||
ready_to_run = std::none_of(thread->wait_objects.begin(), thread->wait_objects.end(),
|
||||
[&thread](const SharedPtr<WaitObject>& object) {
|
||||
return object->ShouldWait(thread.get());
|
||||
});
|
||||
}
|
||||
|
||||
if (ready_to_run) {
|
||||
candidate = thread.get();
|
||||
candidate_priority = thread->current_priority;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue