17#ifndef TOOLBOX_UTIL_TASKQUEUE_HPP
18#define TOOLBOX_UTIL_TASKQUEUE_HPP
20#include <condition_variable>
24inline namespace util {
27template <
typename TaskT>
29 using Lock = std::unique_lock<std::mutex>;
46 template <
typename FnT>
53 const auto pred = [
this] {
return i_ < queue_.size() || stop_; };
55 if (queue_.empty() && stop_) {
58 task = std::move(queue_[i_++]);
60 if (i_ == queue_.size()) {
92 queue_.push_back(std::move(
task));
99 mutable std::mutex mutex_;
100 std::condition_variable cond_;
103 std::vector<TaskT> queue_;