shared and nonshared dtor
    Vlad Levenfeld via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sun Jul 20 02:22:18 PDT 2014
    
    
  
On Sunday, 20 July 2014 at 08:29:55 UTC, Jonathan M Davis wrote:
> What you will probably need to do is to not try and use the 
> same type as both shared and non-shared if it has a destructor.
Unfortunately this option would require an unrealistic lot of 
refactoring for me. I'm basically using this thing as a drop-in 
replacement for arrays, so they go everywhere. I use array-based 
swap buffers to transfer data between threads. I have to declare 
the buffers shared, which makes the arrays shared.
This problem only emerged when I decided I wanted them to free on 
destruction, so it looks like I'll be sticking with manual free 
for awhile longer.
> I would however suggest that you report this as a bug, since it 
> really should be able to distinguish between shared and 
> unshared destructors.
Would it be considered a duplicate of 
https://issues.dlang.org/show_bug.cgi?id=12004 ? At least, all of 
my use cases agree with the bug filer's argument against having 
any shared dtors.
> shared is a great concept, but we are going to need a few 
> adjustments to its design in order to make it properly, fully 
> useable.
Agreed. It's given me a few headaches in the past, but I do like 
the idea of a transitive qualifier that helps me identify 
potentially racy data.
    
    
More information about the Digitalmars-d-learn
mailing list