summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-19 05:44:19 +0100
committerZach Hilman <zachhilman@gmail.com>2018-11-19 05:44:19 +0100
commit409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a (patch)
treeccb9eae7c7e8b93760f3087fb6e67a13cbb24f2c /src/common
parentMerge pull request #1717 from FreddyFunk/swizzle-gob (diff)
downloadyuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.gz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.bz2
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.lz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.xz
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.tar.zst
yuzu-409dcf0e0aecfdb676fd3b64223a25e47c1b1c1a.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/thread_queue_list.h16
1 files changed, 16 insertions, 0 deletions
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 <array>
#include <deque>
+#include <functional>
#include <boost/range/algorithm_ext/erase.hpp>
namespace Common {
@@ -49,6 +50,21 @@ struct ThreadQueueList {
return T();
}
+ T get_first_filter(std::function<bool(T)> 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) {