From 409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 18 Nov 2018 23:44:19 -0500 Subject: svc: Implement yield types 0 and -1 --- src/common/thread_queue_list.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/common') diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 133122c5f..323eab97c 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -6,6 +6,7 @@ #include #include +#include #include namespace Common { @@ -49,6 +50,21 @@ struct ThreadQueueList { return T(); } + T get_first_filter(std::function filter) const { + const Queue* cur = first; + while (cur != nullptr) { + if (!cur->data.empty()) { + for (const auto& item : cur->data) { + if (filter(item)) + return item; + } + } + cur = cur->next_nonempty; + } + + return T(); + } + T pop_first() { Queue* cur = first; while (cur != nullptr) { -- cgit v1.2.3 From 820d81b9a5392951c18daa5a47d6c0ffd28baa9b Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Thu, 22 Nov 2018 00:33:53 -0500 Subject: scheduler: Add explanations for YieldWith and WithoutLoadBalancing --- src/common/thread_queue_list.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common') diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h index 323eab97c..e7594db68 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h @@ -6,7 +6,6 @@ #include #include -#include #include namespace Common { @@ -50,7 +49,8 @@ struct ThreadQueueList { return T(); } - T get_first_filter(std::function filter) const { + template + T get_first_filter(UnaryPredicate filter) const { const Queue* cur = first; while (cur != nullptr) { if (!cur->data.empty()) { -- cgit v1.2.3