[dmd-concurrency] draft 6

Sean Kelly sean at invisibleduck.org
Fri Jan 29 12:17:01 PST 2010


On Jan 28, 2010, at 8:18 AM, Andrei Alexandrescu wrote:

> Thanks for the comments! A few follow-ups below.
> 
> Michel Fortin wrote:
>> 
>>> The ownership relation is not necessarily unidirectional. In fact,
>>> two threads may even own each other; in that case, whichever thread
>>> finishes will notify the other.
>> My idea with the thread termination protocol was that it would
>> prevent circular references, following the owner chain would always
>> lead you back to the main thread. It somewhat breaks the idea that
>> when the main thread terminates all threads end up notified. I don't
>> quite oppose this, but which use case do you have in mind for this?
> 
> I don't. I chose to do what Erlang does. It is quite clear on bidirectional linking and in fact makes it the default, so it must have a reason. Sean?

Originally, I didn't understand the reason for this either.  But thinking about the termination process generated a bunch of examples where bidirectional linking is desired, and few where unidirectional linking is desired.  For example, consider the app that spawns two processes to perform a file copy.  If the writer fails, the reader should terminate as well, and vice-versa.


More information about the dmd-concurrency mailing list