Async messages to a thread.

lindenk ztaticnull at gmail.com
Mon Jul 29 10:07:29 PDT 2013


After a bit more research it looks like everyone else uses -

while(checkIfRunning())
{
     // block with timeout
}

which leads me to believe this might not be possible or standard. 
Although, should something along the lines of this be possible?

Process p = new Process();
p.doTask(p.func()); //create new thread and start function

// do stuff until this needs to exit

p.stop(); // halt running function,
p.cleanup(); // call a clean up function for func's resources
p.kill(); // forcibly kill the thread


If this is possible and/or not a bad idea, how can I accomplish 
this in D? (And if there isn't really a way, I feel like D's 
scope(exit) and such should work nicely with it).


More information about the Digitalmars-d-learn mailing list