MCPcopy Create free account
hub / github.com/WiVRn/WiVRn / pop_if

Method pop_if

common/utils/sync_queue.h:66–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65 template <typename Pred>
66 std::optional<T> pop_if(Pred && pred)
67 {
68 std::unique_lock lock(mutex);
69
70 cv.wait(lock, [&]() { return !queue.empty() || closed; });
71
72 if (closed)
73 throw sync_queue_closed{};
74
75 assert(!queue.empty());
76
77 if (pred(queue.front()))
78 {
79 T item = std::move(queue.front());
80 queue.pop_front();
81
82 return item;
83 }
84
85 return {};
86 }
87
88 T pop()
89 {

Callers 1

on_image_availableMethod · 0.80

Calls 4

waitMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45
pop_frontMethod · 0.45

Tested by

no test coverage detected