mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 14:24:31 +02:00
Use strand<> rather than legacy executor io_context::strand
This commit is contained in:
committed by
Richard Hodges
parent
aef2559c7a
commit
06a0b18b1d
@@ -1,4 +1,4 @@
|
|||||||
|
* Use strand<> rather than legacy executor io_context::strand.
|
||||||
* Use dispatch/post free functions to be independent of executor concept.
|
* Use dispatch/post free functions to be independent of executor concept.
|
||||||
* New name for polymorphic executor. Trait for detecting new executors.
|
* New name for polymorphic executor. Trait for detecting new executors.
|
||||||
* Handler invoke and allocation hooks are deprecated.
|
* Handler invoke and allocation hooks are deprecated.
|
||||||
|
@@ -82,7 +82,7 @@ class frame_test;
|
|||||||
To declare the @ref stream object with a @ref tcp_stream in a
|
To declare the @ref stream object with a @ref tcp_stream in a
|
||||||
multi-threaded asynchronous program using a strand, you may write:
|
multi-threaded asynchronous program using a strand, you may write:
|
||||||
@code
|
@code
|
||||||
websocket::stream<tcp_stream> ws{net::io_context::strand(ioc)};
|
websocket::stream<tcp_stream> ws{net::make_strand(ioc)};
|
||||||
@endcode
|
@endcode
|
||||||
Alternatively, for a single-threaded or synchronous application
|
Alternatively, for a single-threaded or synchronous application
|
||||||
you may write:
|
you may write:
|
||||||
|
@@ -331,8 +331,8 @@ class basic_stream_test
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using tcp = net::ip::tcp;
|
using tcp = net::ip::tcp;
|
||||||
using strand = net::io_context::strand;
|
|
||||||
using executor = net::io_context::executor_type;
|
using executor = net::io_context::executor_type;
|
||||||
|
using strand = net::strand<executor>;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ public:
|
|||||||
// net::io_context::strand
|
// net::io_context::strand
|
||||||
|
|
||||||
{
|
{
|
||||||
auto ex = strand{ioc};
|
auto ex = net::make_strand(ioc);
|
||||||
basic_stream<tcp, strand> s1(ex);
|
basic_stream<tcp, strand> s1(ex);
|
||||||
basic_stream<tcp, strand> s2(ex, tcp::v4());
|
basic_stream<tcp, strand> s2(ex, tcp::v4());
|
||||||
basic_stream<tcp, strand> s3(std::move(s1));
|
basic_stream<tcp, strand> s3(std::move(s1));
|
||||||
@@ -392,11 +392,11 @@ public:
|
|||||||
|
|
||||||
test_sync_stream<
|
test_sync_stream<
|
||||||
basic_stream<
|
basic_stream<
|
||||||
tcp, net::io_context::strand>>();
|
tcp, strand>>();
|
||||||
|
|
||||||
test_async_stream<
|
test_async_stream<
|
||||||
basic_stream<
|
basic_stream<
|
||||||
tcp, net::io_context::strand>>();
|
tcp, strand>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// construction from existing socket
|
// construction from existing socket
|
||||||
|
Reference in New Issue
Block a user