[dmd-concurrency] synchronized, shared, and regular methods inside the same class

Walter Bright walter at digitalmars.com
Mon Jan 11 22:32:44 PST 2010



Andrei Alexandrescu wrote:
>
> You're right, sorry. We've been back and forth on this a couple of 
> times. The knee-jerk reaction is that shared is strictly more 
> restrictive than non-shared, so it's fine to convert from non-shared 
> to shared. But in reality shared and non-shared are in no subtyping 
> relationship; a lot of parallels could be drawn with immutable: 
> immutable is like shared, const would be like mayormaynotbeshared.
>

Yes, it's an easy trap to fall into, and I fell into it several times. 
Thread local cannot be implicitly converted to shared.


More information about the dmd-concurrency mailing list