3#include <boost/container/flat_map.hpp>
23 template <
class =
void>
54 template <
class =
void>
62 boost::container::flat_map<Work*, std::weak_ptr<Work>>
map_;
113 template <
class T,
class... Args>
136 template <
class Finisher>
161 template <
class =
void>
177 ios_->map_.erase(
this);
178 if (--
ios_->n_ == 0 &&
ios_->closed_)
181 ios_->cv_.notify_all();
196template <
class T,
class... Args>
210 sp->Work::ios_ =
this;
211 map_.emplace(sp.get(), sp);
220template <
class Finisher>
228 auto map = std::move(
map_);
233 for (
auto const& p : map)
235 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.