Merge pull request #1732 from DarkLordZach/yield-types

svc: Implement yield types 0 and -1
This commit is contained in:
bunnei 2018-12-15 00:28:12 -05:00 committed by GitHub
commit 2f2fc47af2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 181 additions and 9 deletions

View file

@ -49,6 +49,22 @@ struct ThreadQueueList {
return T();
}
template <typename UnaryPredicate>
T get_first_filter(UnaryPredicate 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) {