[dmd-concurrency] synchronized, shared, and regular methods inside the same class
Michel Fortin
michel.fortin at michelf.com
Wed Jan 6 09:54:01 PST 2010
Le 2010-01-06 à 11:42, Sean Kelly a écrit :
> So how about a quick summary to figure out where we are? From memory, I think it's pretty well established that:
>
> 1. shared denotes visibility. A global shared variable is visible from all threads, an unlabeled variable is thread-local.
> 2. Attaching the shared property to a class instance affects method visibility. shared and synchronized methods are visible, unlabeled ones are not.
> 3. Attaching the shared property to a value makes that value effectively atomic. All access and mutation is accomplished via library calls.
>
> I think there was some concern about the shared property of a class instance automatically extending to all of its fields. Were there other concerns as well? I know that Jason had mentioned issues with non-statically verifiable shared semantics in general, but that's another ball of wax entirely.
Given all the examples I've seen, I'm a little concerned that synchronization will only work with class members. What about structs and shared globals? Is there going to be a safe way to keep them synchronized? Or is that irrelevant?
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the dmd-concurrency
mailing list