Passing class references between threads

Nick Gurrola ngurrola17 at gmail.com
Fri Jun 22 20:48:57 PDT 2012


I'm trying to figure out how to pass a class reference between 
threads. I'm using the new std.process and want to wait for the 
process to exit in a separate thread while storing a reference to 
the ProcessPipes, but D won't let you pass non-shared mutable 
data. The reference can't be immutable, so is there any way to 
make it shared without altering the class definition? Here is the 
code:

pipes = pipeProcess(runCommand);
spawn(&waitProcess, pipes);

pipes is in the class definition as

ProcessPipes pipes;

How could I do this?


More information about the Digitalmars-d-learn mailing list