diff --git a/CHANGELOG.md b/CHANGELOG.md index 217115be..cd3249b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ +* Use dispatch/post free functions to be independent of executor concept. * New name for polymorphic executor. Trait for detecting new executors. * Handler invoke and allocation hooks are deprecated. diff --git a/include/boost/beast/_experimental/test/impl/stream.hpp b/include/boost/beast/_experimental/test/impl/stream.hpp index 5ca612d3..3d58fdb0 100644 --- a/include/boost/beast/_experimental/test/impl/stream.hpp +++ b/include/boost/beast/_experimental/test/impl/stream.hpp @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -90,6 +92,13 @@ class stream::read_op : public stream::read_op_base { } + using allocator_type = net::associated_allocator_t; + + allocator_type get_allocator() const noexcept + { + return net::get_associated_allocator(h_); + } + void operator()(error_code ec) { @@ -115,10 +124,9 @@ class stream::read_op : public stream::read_op_base } } - auto alloc = net::get_associated_allocator(h_); - wg2_.get_executor().dispatch( + net::dispatch(wg2_.get_executor(), beast::bind_front_handler(std::move(h_), - ec, bytes_transferred), alloc); + ec, bytes_transferred)); wg2_.reset(); } }; @@ -140,10 +148,8 @@ public: void operator()(error_code ec) override { - - auto alloc = net::get_associated_allocator(fn_.h_); - wg1_.get_executor().post( - beast::bind_front_handler(std::move(fn_), ec), alloc); + net::post(wg1_.get_executor(), + beast::bind_front_handler(std::move(fn_), ec)); wg1_.reset(); } };