Is the following code safe?
boost::asio::io_service io_service;
auto socket(new std::unique_ptr<boost::asio::tcp::socket>(io_service);
.
.
.
boost::asio::async_read(*socket, buffer, handler);
socket.reset();
Or do I need to wait for the handler to run before I am allowed to delete the socket?
Also will using socket->async_receive(...)
instead make any difference
I am interested in this on both windows and linux.