Does anyone understand how to use "shared" types with concurrency send/receive functions?

Kagamin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 15 03:37:08 PDT 2017


Well, no wrapper is actually needed here:

class A
{
	int method() shared;
}

void consumer()
{
	shared a = receiveOnly!(shared A)();
}

void producer()
{
	auto cons = spawn(&consumer);
	send(cons, new shared A());
}


More information about the Digitalmars-d-learn mailing list