From the documentation, most Asio classes are NOT thread-safe. So I wonder is it safe for a user thread to access an object in async operation?
For example, if a socket is async connecting:
asio::async_connect(socket, endpoint_iterator, handler);
I suppose there will be an Asio internal thread (e.g. one runs io_service.run()
) to do something on socket
(No?). Is it safe to call socket.close()
before the async_connect
finishes (for timeout for example)? Will it race with any Asio internal thread?