Merge pull request #1732 from DarkLordZach/yield-types
svc: Implement yield types 0 and -1
This commit is contained in:
commit
2f2fc47af2
5 changed files with 181 additions and 9 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue