[dmd-concurrency] Shutdown protocol

Michel Fortin michel.fortin at michelf.com
Wed Jan 20 10:59:41 PST 2010


Le 2010-01-20 à 12:20, Andrei Alexandrescu a écrit :

> I like this. All - any related thoughts?
> 
> Truth be told we can fix the example by changing main:
> 
> wait(spawn(&copy("in1", "out1")), spawn(&copy("in2", "out2")));
> 
> which I think is entirely fair.

As I said, (although I used 'join' instead of 'wait' to say it), using 'wait' this way will leave the writer thread alive while the second copy finishes. It's not too bad with only two copies, but if your program is long-lived and is making a lot of copy threads while it runs you'll end up with a lot of forgotten do-nothing writer threads until the program finishes.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the dmd-concurrency mailing list