
On Mon, 7 Mar 2011 18:43:53 +0200 "Peter Dimov" <pdimov@pdimov.com> wrote:
Can you please provide more details? Why is not CoW thread safe?
Because the copy-on-write functionality is entirely internal to the class. Nothing outside it can tell whether it's safe to modify an integer or not, in the presence of multithreading. Even the library itself can't tell unless I add locking for each integer object, which would slow things down and introduce a compiled dependency for little benefit.
Unless you allow non-const references or iterators to your shared data, code outside can't modify it without you being aware of it, and CoW is transparent (assuming atomic reference counting). [...]
That might be assuming too much, for the moment. I'm not sure of the current status of Boost.Atomic, but I know enough about the topic that I don't trust my ability to implement it myself properly. Once that library is official, I'll be happy to include and use it. -- Chad Nelson Oak Circle Software, Inc. * * *