diff options
| author | 2018-12-15 00:28:12 -0500 | |
|---|---|---|
| committer | 2018-12-15 00:28:12 -0500 | |
| commit | 2f2fc47af23708f4a79c1e3b554aafd84a32f7db (patch) | |
| tree | 02114974dac4e65b2a1a011c7cad68b32a6a6a47 /src/common/thread_queue_list.h | |
| parent | Merge pull request #1902 from lioncash/audio (diff) | |
| parent | svc: Avoid incorrect fast yield condition (diff) | |
| download | yuzu-2f2fc47af23708f4a79c1e3b554aafd84a32f7db.tar.gz yuzu-2f2fc47af23708f4a79c1e3b554aafd84a32f7db.tar.xz yuzu-2f2fc47af23708f4a79c1e3b554aafd84a32f7db.zip | |
Merge pull request #1732 from DarkLordZach/yield-types
svc: Implement yield types 0 and -1
Diffstat (limited to 'src/common/thread_queue_list.h')
| -rw-r--r-- | src/common/thread_queue_list.h | 16 |
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..e7594db68 100644 --- a/src/common/thread_queue_list.h +++ b/src/common/thread_queue_list.h | |||
| @@ -49,6 +49,22 @@ struct ThreadQueueList { | |||
| 49 | return T(); | 49 | return T(); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | template <typename UnaryPredicate> | ||
| 53 | T get_first_filter(UnaryPredicate filter) const { | ||
| 54 | const Queue* cur = first; | ||
| 55 | while (cur != nullptr) { | ||
| 56 | if (!cur->data.empty()) { | ||
| 57 | for (const auto& item : cur->data) { | ||
| 58 | if (filter(item)) | ||
| 59 | return item; | ||
| 60 | } | ||
| 61 | } | ||
| 62 | cur = cur->next_nonempty; | ||
| 63 | } | ||
| 64 | |||
| 65 | return T(); | ||
| 66 | } | ||
| 67 | |||
| 52 | T pop_first() { | 68 | T pop_first() { |
| 53 | Queue* cur = first; | 69 | Queue* cur = first; |
| 54 | while (cur != nullptr) { | 70 | while (cur != nullptr) { |