| 90 | } |
| 91 | |
| 92 | bool QueuedScheduler::dispatchInternal(bool blockIfNoTasks) { |
| 93 | async::task_run_handle t; |
| 94 | |
| 95 | { |
| 96 | std::unique_lock<std::mutex> guard(this->_pImpl->mutex); |
| 97 | t = this->_pImpl->queue.pop(); |
| 98 | if (blockIfNoTasks && !t) { |
| 99 | this->_pImpl->conditionVariable.wait(guard); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | if (t) { |
| 104 | auto scope = this->immediate.scope(); |
| 105 | t.run(); |
| 106 | return true; |
| 107 | } else { |
| 108 | return false; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | void QueuedScheduler::unblock() { |
| 113 | std::unique_lock<std::mutex> guard(this->_pImpl->mutex); |
no test coverage detected