2#include <boost/asio.hpp>
12namespace asio = boost::asio;
18 "Make sure it always outlives all the requests pushed onto it.");
22 boost::asio::const_buffers_1 data,
26 _itemQueue.push_back({std::move(sock), std::move(data), std::move(callback)});
46 asio::async_write(*(item.sock),
48 [item,
this](boost::system::error_code
const &,
std::size_t) {
50 this->sendCompleted();
#define PRECICE_ASSERT(...)
bool _ready
Is the queue allowed to start another asynchronous send?
void sendCompleted()
Notifies the queue that the last asynchronous send operation has completed.
std::mutex _queueMutex
The mutex protecting access to the queue.
std::deque< SendItem > _itemQueue
The queue, containing items to asynchronously send using boost.asio.
void dispatch(std::shared_ptr< Socket > sock, boost::asio::const_buffers_1 data, std::function< void()> callback)
Put data in the queue, start processing the queue.
~SocketSendQueue()
If items are left in the queue upon destruction, something went really wrong.
void process()
This method can be called arbitrarily many times, but enough times to ensure the queue makes progress...
contains the data communication abstraction layer.