Something needs to happen with shared, and soon.

Walter Bright newshound2 at digitalmars.com
Tue Nov 13 17:39:08 PST 2012


On 11/13/2012 4:04 PM, deadalnix wrote:
> That is what java's volatile do. It have several uses cases, including valid
> double check locking (It has to be noted that this idiom is used incorrectly in
> druntime ATM,

Please, please file a bug report about this, rather than a vague statement here. 
If there already is one, please post its number.


> So sequentially consistent read/write are usefull.

Sure, I agree with that.


> This struct stuff don't make any sense to me. Java, C# and many other language
> multithread, have everything shared and still are able to have finalizer of some
> sort.

I understand, though, that they take steps to ensure that the finalizer is run 
in one thread and no other thread still has access to it - i.e. it is converted 
back to a local reference.

> Why couldn't a shared object be destroyed ? Why should it be destroyed in a
> specific thread as it can only refer shared data because of transitivity ?

How can you destroy an object in one thread when another thread holding live 
references to it? (Well, how can you destroy it without causing corruption bugs, 
that is.)


More information about the Digitalmars-d mailing list