Hi guys...I've 2 thread and I would like that one of these performs a synchronous read, menawhile the other performs a synchrounous write...adn obviously they share the same socket.....the signature of the functions are the following:

length=boost::asio::read(socket_,boost::asio::buffer(msg,sizeof(msg)), ec);
         boost::asio::write(socket_,boost::asio::buffer(msgToSend,sizeof(msgToSend)));

socket_ is a private field of the classe Server.

How can I use the mutex to perform concurrently and safetly these operations?

Thanks..