From 06a0b18b1d3767aa24173accbcfdf4b7d1988778 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Tue, 23 Jun 2020 11:26:44 +1000 Subject: [PATCH] Use strand<> rather than legacy executor io_context::strand --- CHANGELOG.md | 2 +- include/boost/beast/websocket/stream.hpp | 2 +- test/beast/core/basic_stream.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd3249b1..31579a4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ - +* Use strand<> rather than legacy executor io_context::strand. * 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/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp index 83ac2e9c..f7c8cab9 100644 --- a/include/boost/beast/websocket/stream.hpp +++ b/include/boost/beast/websocket/stream.hpp @@ -82,7 +82,7 @@ class frame_test; To declare the @ref stream object with a @ref tcp_stream in a multi-threaded asynchronous program using a strand, you may write: @code - websocket::stream ws{net::io_context::strand(ioc)}; + websocket::stream ws{net::make_strand(ioc)}; @endcode Alternatively, for a single-threaded or synchronous application you may write: diff --git a/test/beast/core/basic_stream.cpp b/test/beast/core/basic_stream.cpp index a48971ef..46e8ec47 100644 --- a/test/beast/core/basic_stream.cpp +++ b/test/beast/core/basic_stream.cpp @@ -331,8 +331,8 @@ class basic_stream_test { public: using tcp = net::ip::tcp; - using strand = net::io_context::strand; using executor = net::io_context::executor_type; + using strand = net::strand; //-------------------------------------------------------------------------- @@ -372,7 +372,7 @@ public: // net::io_context::strand { - auto ex = strand{ioc}; + auto ex = net::make_strand(ioc); basic_stream s1(ex); basic_stream s2(ex, tcp::v4()); basic_stream s3(std::move(s1)); @@ -392,11 +392,11 @@ public: test_sync_stream< basic_stream< - tcp, net::io_context::strand>>(); + tcp, strand>>(); test_async_stream< basic_stream< - tcp, net::io_context::strand>>(); + tcp, strand>>(); } // construction from existing socket