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

crimaniak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 12 19:50:13 PDT 2017


On Saturday, 12 August 2017 at 18:57:44 UTC, Arek wrote:
> I have the folowing problem:
> I like to envelope the class object in struct to control the 
> destruction moment and then send this object to another 
> thread/fiber (or task, cause I use vibe-d).
>
> I can't find any method to make it working. Any ideas?

I tried it too some time ago. Then I read Alexandrescu book and 
realized that the authors of the language do not want anyone to 
do this. Long story short, just plan your application so that 
each complex object is monitored by only one thread/task, and 
pass not objects, but messages (immutable structs) about what to 
do with them.



More information about the Digitalmars-d-learn mailing list