
7 Mar
2011
7 Mar
'11
4:51 a.m.
On Mon, 7 Mar 2011 03:01:51 +0200 "Peter Dimov" <pdimov@pdimov.com> wrote:
The only concrete complaint that people could give me about CoW was that code using it couldn't be made thread-safe, which is true.
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. -- Chad Nelson Oak Circle Software, Inc. * * *