20#ifndef RIPPLE_SERVER_IO_LIST_H_INCLUDED
21#define RIPPLE_SERVER_IO_LIST_H_INCLUDED
23#include <boost/container/flat_map.hpp>
41 template <
class =
void>
71 template <
class =
void>
79 boost::container::flat_map<work*, std::weak_ptr<work>>
map_;
128 template <
class T,
class... Args>
150 template <
class Finisher>
174 template <
class =
void>
209template <
class T,
class... Args>
217 auto sp = std::make_shared<T>(std::forward<Args>(args)...);
224 sp->work::ios_ =
this;
225 map_.emplace(sp.get(), sp);
234template <
class Finisher>
242 auto map = std::move(
map_);
245 f_ = std::forward<Finisher>(f);
247 for (
auto const& p : map)
248 if (
auto sp = p.second.lock())
io_list & ios()
Return the io_list associated with the work.
Manages a set of objects performing asynchronous I/O.
~io_list()
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_
std::shared_ptr< T > emplace(Args &&... args)
Create associated work if not closed.
std::function< void(void)> f_
std::condition_variable cv_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.