On 10/10/13 7:04 PM, Jonathan M Davis wrote:
On Thursday, October 10, 2013 18:21:52 Andrei Alexandrescu wrote:
You can't EVER expect to obtain all of that magic by plastering "shared"
on top of your type.
It works just fine with the idiom that I described where you protect the usage
of the object with a lock, cast it to thread-local to do stuff on it, and then
release the lock (making sure that no thread-local references remain).
TDPL describes how synchronized automatically peels off the "shared" off
of direct members of the object. Unfortunately that feature is not yet
implemented.
Andrei