Does anyone understand how to use "shared" types with concurrency send/receive functions?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Aug 17 06:32:38 PDT 2017
On 8/17/17 8:41 AM, Kagamin wrote:
> On Wednesday, 16 August 2017 at 13:14:55 UTC, Steven Schveighoffer wrote:
>> But that isn't a concern for Variant. It is only calling the postblit,
>> which does work.
>
> Shouldn't it call destructor when it goes out of scope?
You're right, and it does. It uses the typeid to destroy it, which I
think ignores any attributes.
I've updated my PR to switch to the __xdtor method, which takes into
account attributes of the method.
This doesn't suffer from the same incorrect assumption the compiler
makes when destroying something in a scope, so ironically, using a
Variant to wrap a shared type with a destructor is going to work better
than using the stack :)
-Steve
More information about the Digitalmars-d-learn
mailing list