svc: Implement yield types 0 and -1
This commit is contained in:
parent
e84cceb645
commit
b1c19bc88f
6 changed files with 130 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue