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
Wed Aug 16 06:14:55 PDT 2017


On 8/16/17 9:04 AM, Kagamin wrote:
> On Wednesday, 16 August 2017 at 12:58:25 UTC, Steven Schveighoffer wrote:
>> Use cases don't matter. What matters is: is it proper for Variant to 
>> call the postblit (as it does currently) without regard for the 
>> qualifiers?
> 
> Looks like it isn't, https://dpaste.dzfl.pl/183e6dae9867 - shared 
> reference counter with (probably) good enough postblit.

I have found that shared dtor doesn't work:

struct S
{
   ~this() shared {}
}

void main()
{
    shared S s; // Error: shared method testshared.S.~this is not 
callable using a non-shared object
}

But shared postblit does work.

Kind of a bummer. Though I think we need some work on the destructors 
and postblits -- you can't overload them based on qualifiers.

But that isn't a concern for Variant. It is only calling the postblit, 
which does work.

-Steve


More information about the Digitalmars-d-learn mailing list