| 154 | } |
| 155 | |
| 156 | bool pop(T& t) |
| 157 | { |
| 158 | std::unique_lock<std::mutex> lock(impl_->mutex_); |
| 159 | while (impl_->queue_.empty() && !impl_->stop_) |
| 160 | impl_->condition_.wait(lock); |
| 161 | if (!impl_->queue_.empty()) |
| 162 | { |
| 163 | t = impl_->queue_.front(); |
| 164 | impl_->queue_.pop(); |
| 165 | return true; |
| 166 | } |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | private: |
| 171 | std::shared_ptr<queue_impl<T>> impl_; |
no test coverage detected