[dmd-concurrency] shared arrays, real, shared classes, synchronized classes
Brad Roberts
braddr at puremagic.com
Fri Jan 29 17:23:45 PST 2010
On Fri, 29 Jan 2010, Andrei Alexandrescu wrote:
> Rationale: it is tenuous to offer mixed modes in the same class.
>
> 4. The "synchronized" attribute is hoisted at class level:
>
> synchronized class A { ... }
>
> That means each and every method of that class is synchronized.
>
> 5. The "shared" attribute is hoisted at class or struct level:
>
> shared class A { ... }
> shared struct B { ... }
>
> That means the implementation is lock-free and uses its own synchronization
> mechanisms.
>
> 6. When defining an object of a synchronized of shared type, you still need to
> qualify it with "shared" in order to make it so. For example:
>
> synchronized class A { ... }
> shared A a; // fine
> A b; // error
>
> (I'm not 100% sure about this.)
What are the rules for these two attributes (add 'scope' to the list too)
behave in terms of class hierarchies?
More information about the dmd-concurrency
mailing list