On 03/11/2011 06:14 AM, Gordon Sim wrote:

..the iterator may be invalidated by a subsequent update to the map once the lock is released. Testing against bindingCache.end() outside the lock is also not safe.

I don't believe so, as it holds a smart pointer, the smart pointer will hold the memory from .second, so even if the map is released the memory will remain safe. This is the whole point of the code, that you can free the map under the current route. the smart pointer protects the memory.

So the commit is thread safe.

I can assign second to a local smart pointer under the lock to make it more readable, but the code is
thread safe.

Carl.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to