Thread: Implement priority boost for starved threads.
SVC: Return correct error code on invalid CreateThread processor ID. SVC: Assert when creating a thread with an invalid userland priority.
This commit is contained in:
parent
ee3377b67d
commit
7b9f428b23
5 changed files with 92 additions and 28 deletions
|
@ -40,6 +40,18 @@ struct ThreadQueueList {
|
|||
return -1;
|
||||
}
|
||||
|
||||
T get_first() {
|
||||
Queue *cur = first;
|
||||
while (cur != nullptr) {
|
||||
if (!cur->data.empty()) {
|
||||
return cur->data.front();
|
||||
}
|
||||
cur = cur->next_nonempty;
|
||||
}
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
T pop_first() {
|
||||
Queue *cur = first;
|
||||
while (cur != nullptr) {
|
||||
|
@ -79,6 +91,12 @@ struct ThreadQueueList {
|
|||
cur->data.push_back(thread_id);
|
||||
}
|
||||
|
||||
void move(const T& thread_id, Priority old_priority, Priority new_priority) {
|
||||
remove(old_priority, thread_id);
|
||||
prepare(new_priority);
|
||||
push_back(new_priority, thread_id);
|
||||
}
|
||||
|
||||
void remove(Priority priority, const T& thread_id) {
|
||||
Queue *cur = &queues[priority];
|
||||
boost::remove_erase(cur->data, thread_id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue