mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
Send from the strand
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
Version 207
|
||||
|
||||
* Send from the strand
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 206
|
||||
|
||||
* Clear error codes idiomatically
|
||||
|
@ -90,6 +90,17 @@ void
|
||||
websocket_session::
|
||||
send(boost::shared_ptr<std::string const> const& ss)
|
||||
{
|
||||
// Get on the strand if we aren't already,
|
||||
// otherwise we will concurrently access
|
||||
// objects which are not thread-safe.
|
||||
if(! strand_.running_in_this_thread())
|
||||
return net::post(
|
||||
net::bind_executor(strand_,
|
||||
std::bind(
|
||||
&websocket_session::send,
|
||||
shared_from_this(),
|
||||
ss)));
|
||||
|
||||
// Always add to queue
|
||||
queue_.push_back(ss);
|
||||
|
||||
|
Reference in New Issue
Block a user