New name for polymorphic executor. Trait for detecting new executors

This commit is contained in:
Christopher Kohlhoff
2020-06-23 09:50:03 +10:00
committed by Richard Hodges
parent 22f2f5dcf4
commit 55302a3f8f
13 changed files with 22 additions and 19 deletions

View File

@ -1,3 +1,5 @@
* New name for polymorphic executor. Trait for detecting new executors.
* Handler invoke and allocation hooks are deprecated. * Handler invoke and allocation hooks are deprecated.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -53,7 +53,7 @@ class session : public std::enable_shared_from_this<session>
public: public:
explicit explicit
session( session(
net::executor ex, net::any_io_executor ex,
ssl::context& ctx) ssl::context& ctx)
: resolver_(ex) : resolver_(ex)
, stream_(ex, ctx) , stream_(ex, ctx)

View File

@ -182,7 +182,7 @@ class async_base
#endif #endif
{ {
static_assert( static_assert(
net::is_executor<Executor1>::value, net::is_executor<Executor1>::value || net::execution::is_executor<Executor1>::value,
"Executor type requirements not met"); "Executor type requirements not met");
Handler h_; Handler h_;

View File

@ -182,7 +182,7 @@ namespace beast {
@tparam Executor A type meeting the requirements of <em>Executor</em> to @tparam Executor A type meeting the requirements of <em>Executor</em> to
be used for submitting all completion handlers which do not already have an be used for submitting all completion handlers which do not already have an
associated executor. If this type is omitted, the default of `net::executor` associated executor. If this type is omitted, the default of `net::any_io_executor`
will be used. will be used.
@par Thread Safety @par Thread Safety
@ -197,7 +197,7 @@ namespace beast {
*/ */
template< template<
class Protocol, class Protocol,
class Executor = net::executor, class Executor = net::any_io_executor,
class RatePolicy = unlimited_rate_policy class RatePolicy = unlimited_rate_policy
> >
class basic_stream class basic_stream
@ -233,7 +233,8 @@ public:
using endpoint_type = typename Protocol::endpoint; using endpoint_type = typename Protocol::endpoint;
private: private:
static_assert(net::is_executor<Executor>::value, static_assert(
net::is_executor<Executor>::value || net::execution::is_executor<Executor>::value,
"Executor type requirements not met"); "Executor type requirements not met");
struct impl_type struct impl_type

View File

@ -56,7 +56,7 @@ get_io_context(net::strand<Executor> const& ex)
template< template<
class T, class T,
class = typename std::enable_if< class = typename std::enable_if<
std::is_same<T, net::executor>::value>::type> std::is_same<T, net::executor>::value || std::is_same<T, net::any_io_executor>::value>::type>
net::io_context* net::io_context*
get_io_context(T const& ex) get_io_context(T const& ex)
{ {

View File

@ -25,7 +25,7 @@ namespace beast {
*/ */
using tcp_stream = basic_stream< using tcp_stream = basic_stream<
net::ip::tcp, net::ip::tcp,
net::executor, net::any_io_executor,
unlimited_rate_policy>; unlimited_rate_policy>;
} // beast } // beast

View File

@ -32,13 +32,13 @@ public:
BEAST_EXPECT(get_io_context(ioc) == &ioc); BEAST_EXPECT(get_io_context(ioc) == &ioc);
BEAST_EXPECT(get_io_context(ioc.get_executor()) == &ioc); BEAST_EXPECT(get_io_context(ioc.get_executor()) == &ioc);
BEAST_EXPECT(get_io_context(net::make_strand(ioc)) == &ioc); BEAST_EXPECT(get_io_context(net::make_strand(ioc)) == &ioc);
BEAST_EXPECT(get_io_context(net::executor(ioc.get_executor())) == &ioc); BEAST_EXPECT(get_io_context(net::any_io_executor(ioc.get_executor())) == &ioc);
#if 0 #if 0
// VFALCO FIXME // VFALCO FIXME
BEAST_EXPECT( BEAST_EXPECT(
get_io_context( get_io_context(
net::strand<net::executor>( net::strand<net::any_io_executor>(
net::executor(ioc.get_executor()))) == &ioc); net::any_io_executor(ioc.get_executor()))) == &ioc);
#endif #endif
} }

View File

@ -43,12 +43,12 @@ namespace beast {
#if 0 #if 0
template class basic_stream< template class basic_stream<
net::ip::tcp, net::ip::tcp,
net::executor, net::any_io_executor,
unlimited_rate_policy>; unlimited_rate_policy>;
template class basic_stream< template class basic_stream<
net::ip::tcp, net::ip::tcp,
net::executor, net::any_io_executor,
simple_rate_policy>; simple_rate_policy>;
#endif #endif

View File

@ -28,7 +28,7 @@ public:
net::make_strand(ioc.get_executor()); net::make_strand(ioc.get_executor());
net::make_strand(net::make_strand(ioc)); net::make_strand(net::make_strand(ioc));
net::executor ex(ioc.get_executor()); net::any_io_executor ex(ioc.get_executor());
net::make_strand(ex); net::make_strand(ex);
// this *should-not* compile // this *should-not* compile

View File

@ -378,7 +378,7 @@ public:
using socket_type = using socket_type =
net::basic_stream_socket< net::basic_stream_socket<
net::ip::tcp, net::ip::tcp,
net::executor>; net::any_io_executor>;
net::io_context ioc; net::io_context ioc;
stream<socket_type> ws1(ioc); stream<socket_type> ws1(ioc);
stream<socket_type> ws2(ioc); stream<socket_type> ws2(ioc);

View File

@ -62,7 +62,7 @@ public:
boost::asio::ssl::stream< boost::asio::ssl::stream<
boost::asio::basic_stream_socket< boost::asio::basic_stream_socket<
boost::asio::ip::tcp, boost::asio::ip::tcp,
boost::asio::executor>>>(); net::any_io_executor>>>();
} }
}; };

View File

@ -288,7 +288,7 @@ struct associated_allocator<handler, Allocator>
template<class Executor> template<class Executor>
struct associated_executor<handler, Executor> struct associated_executor<handler, Executor>
{ {
using type = boost::asio::executor; using type = boost::asio::any_io_executor;
static static
type type

View File

@ -205,7 +205,7 @@ core_3_timeouts_snippets()
// if the choice of RatePolicy is not DefaultConstructible, // if the choice of RatePolicy is not DefaultConstructible,
// an instance of the type may be passed to the constructor. // an instance of the type may be passed to the constructor.
basic_stream<net::ip::tcp, net::executor, simple_rate_policy> stream(ioc); basic_stream<net::ip::tcp, net::any_io_executor, simple_rate_policy> stream(ioc);
// The policy object, which is default constructed, or // The policy object, which is default constructed, or
// decay-copied upon construction, is attached to the stream // decay-copied upon construction, is attached to the stream
@ -586,7 +586,7 @@ core_3_timeouts_snippets2()
//[code_core_3_timeouts_9 //[code_core_3_timeouts_9
// This stream will use our new rate_gauge policy // This stream will use our new rate_gauge policy
basic_stream<net::ip::tcp, net::executor, rate_gauge> stream(ioc); basic_stream<net::ip::tcp, net::any_io_executor, rate_gauge> stream(ioc);
//... //...
@ -600,7 +600,7 @@ core_3_timeouts_snippets2()
} // (anon) } // (anon)
template class basic_stream<net::ip::tcp, net::executor, rate_gauge>; template class basic_stream<net::ip::tcp, net::any_io_executor, rate_gauge>;
struct core_3_timeouts_test struct core_3_timeouts_test
: public beast::unit_test::suite : public beast::unit_test::suite