[dmd-concurrency] shared arrays, real, shared classes, synchronized classes

Andrei Alexandrescu andrei at erdani.com
Fri Jan 29 18:04:35 PST 2010


Michel Fortin wrote:
> Le 2010-01-29 à 18:03, Andrei Alexandrescu a écrit :
[snip approval]

Wow. This proposal has a chance of going through the Senate rather
easily :o).

> What happens with inheritance?

Let's discuss that separately. Baseline: inheritors must write down
again the threading model, i.e. shared inherits shared etc.

> Also, what happens if you have a shared variable in your synchronized
> class?

It doesn't matter because synchronized class objects are shared anyway.
Shared is therefore redundant.

>> 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.)
> 
> I agree with Robert Jacques, this won't work very well. Also, I think
> the third line above should declare a thread-local reference to a
> shared object. This would solve the tail-shared problem.

Good idea. I realize there will be a fair amount of confusion because 
"shared" is at the same time a qualifier and a storage class when 
applied to a global.


Andrei



More information about the dmd-concurrency mailing list