Boost logo

Boost Users :

Subject: Re: [Boost-users] [ASIO] Thread safety of socket.write_some & socket.read_some
From: Igor R (boost.lists_at_[hidden])
Date: 2008-11-03 08:03:20


By the way, note that in the latest ASIO (boost 1.37.0) the
synchronous operations are thread safe:

http://beta.boost.org/users/news/version_1_37_0
Updated Libraries
Asio:
* Synchronous read, write, accept and connect operations are now
thread safe (meaning that it is now permitted to perform concurrent
synchronous operations on an individual socket, if supported by the
OS).

>>> Accessing the same socket object from different threads is unsafe:
>>
>>> http://www.boost.org/doc/libs/1_36_0/doc/html/boost_asio/reference/ip__tcp/socket.html
>>> "Thread Safety
>>> Distinct objects: Safe.
>>> Shared objects: Unsafe. "
>>
> Does this mean that I can still use the socket object from different threads
> if I use some kind of locking method to make sure that only one thread at a
> time uses the socket?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net