3#include <boost/container/flat_map.hpp>
20 template <
class =
void>
50 template <
class =
void>
58 boost::container::flat_map<Work*, std::weak_ptr<Work>>
map_;
107 template <
class T,
class... Args>
129 template <
class Finisher>
153 template <
class =
void>
169 ios_->map_.erase(
this);
170 if (--
ios_->n_ == 0 &&
ios_->closed_)
173 ios_->cv_.notify_all();
188template <
class T,
class... Args>
202 sp->Work::ios_ =
this;
203 map_.emplace(sp.get(), sp);
212template <
class Finisher>
220 auto map = std::move(
map_);
225 for (
auto const& p : map)
227 if (
auto sp = p.second.lock())
IOList & ios()
Return the IOList associated with the work.
std::condition_variable cv_
std::shared_ptr< T > emplace(Args &&... args)
Create associated work if not closed.
std::function< void(void)> f_
~IOList()
Destroy the list.
bool closed() const
Return true if the list is closed.
void join()
Block until the io_list stops.
boost::container::flat_map< Work *, std::weak_ptr< Work > > map_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.