[dmd-concurrency] Shutdown protocol

Andrei Alexandrescu andrei at erdani.com
Thu Jan 21 00:14:37 PST 2010


Kevin Bealer wrote:
> Assuming one reader.  What about a scenario where there are several each 
> of readers and writers, maybe the data flow of 'diff' as a simple example?

In that case my analysis doesn't stand. A different approach should be 
devised.

> In this case we should assume that main knows the tids of all the 
> readers rather than running them directly as in the two thread file copy 
> example.  More generally, for any set of queues, main would need to 
> knows about the side that has to finish for completeness to be 
> guaranteed, which seems like it will be the side that is filling the 
> queue, right?

For general queues, a end-of-stream signal must travel. Michel made a 
good point that I should better define solid protocols even in simple 
examples, so I'll change the code accordingly.

> So lets say that threads will normally fall into the three camps, that 
> I'll call producers, filters and processors.
[snip]
> Main could check if it has any dependents, if desired... (these last 
> bits is kind of off the cuff, so maybe there are huge problems with them.)

This makes sense, but at this point I'd avoid classifications that don't 
have a precedent. If Erlang made it without thread kinds, we should too.


Andrei


More information about the dmd-concurrency mailing list