| 100 | } |
| 101 | |
| 102 | bool PollOne() |
| 103 | { |
| 104 | std::function<void()> task; |
| 105 | { |
| 106 | std::lock_guard<std::mutex> lck(mtx); |
| 107 | if (!running || tasks.empty()) |
| 108 | return false; |
| 109 | task = tasks.front(); |
| 110 | tasks.pop(); |
| 111 | } |
| 112 | |
| 113 | if (task) |
| 114 | task(); |
| 115 | |
| 116 | return true; |
| 117 | } |
| 118 | |
| 119 | private: |
| 120 | std::queue<std::function<void()>> tasks; |
nothing calls this directly
no outgoing calls
no test coverage detected