Add executor rebind to test::stream

closes #2139
This commit is contained in:
Richard Hodges
2020-12-16 21:11:29 +01:00
parent a87330e53f
commit 8913a3cd21
13 changed files with 619 additions and 400 deletions
+10 -4
View File
@@ -34,12 +34,18 @@ namespace beast {
namespace {
#if defined(BOOST_ASIO_NO_TS_EXECUTORS)
static struct ex1_context : net::execution_context
{
} ex1ctx;
struct ex1_type
{
net::execution_context &
query(net::execution::context_t c) const noexcept
{ return *reinterpret_cast<net::execution_context *>(0); }
{ return *reinterpret_cast<net::execution_context *>(&ex1ctx); }
net::execution::blocking_t
query(net::execution::blocking_t) const noexcept
@@ -716,9 +722,9 @@ public:
net::steady_timer timer;
temporary_data(std::string message_, net::io_context& ctx)
temporary_data(std::string message_, net::any_io_executor ex)
: message(std::move(message_))
, timer(ctx)
, timer(std::move(ex))
{
}
};
@@ -733,7 +739,7 @@ public:
, repeats_(repeats)
, data_(allocate_stable<temporary_data>(*this,
std::move(message),
net::query(stream.get_executor(), net::execution::context)))
stream.get_executor()))
{
(*this)(); // start the operation
}