summaryrefslogtreecommitdiffstats
path: root/src/common/thread_queue_list.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-04-10 05:05:49 +0200
committerbunnei <bunneidev@gmail.com>2015-04-10 05:05:49 +0200
commit6f1143885bcc02642b707b51355fe4b6cd5375c7 (patch)
treefe1307919e7087df41c498b971016ffa931d6594 /src/common/thread_queue_list.h
parentMerge pull request #690 from Zaneo/sharedmemory (diff)
parentSVC: Assert on unsupported CreateThread processor ID. (diff)
downloadyuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.gz
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.bz2
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.lz
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.xz
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.tar.zst
yuzu-6f1143885bcc02642b707b51355fe4b6cd5375c7.zip
Diffstat (limited to 'src/common/thread_queue_list.h')
-rw-r--r--src/common/thread_queue_list.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h
index 444abf115..4f27fc899 100644
--- a/src/common/thread_queue_list.h
+++ b/src/common/thread_queue_list.h
@@ -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);