| 82 | } |
| 83 | |
| 84 | bool ExecOne() |
| 85 | { |
| 86 | std::function<void()> task; |
| 87 | { |
| 88 | std::unique_lock<std::mutex> lck(mtx); |
| 89 | cv.wait(lck, [this](){ return !running || !tasks.empty(); }); |
| 90 | if (!running) |
| 91 | return false; |
| 92 | task = tasks.front(); |
| 93 | tasks.pop(); |
| 94 | } |
| 95 | |
| 96 | if (task) |
| 97 | task(); |
| 98 | |
| 99 | return true; |
| 100 | } |
| 101 | |
| 102 | bool PollOne() |
| 103 | { |
no outgoing calls