[dmd-concurrency] priority messages

Andrei Alexandrescu andrei at erdani.com
Mon Jan 25 09:31:48 PST 2010


Michel Fortin wrote:
> Le 2010-01-25 à 11:20, Andrei Alexandrescu a écrit :
> 
>> Michel Fortin wrote:
>>> Personally I'd tend to just not define any priority and deal with
>>> things in a FIFO manner to keep things simple. If you want to add
>>> complexity (priority), it should be justified by use cases. So which
>>> use case do you have in mind for priority?
>> Thread termination! Also forcibly closing any protocol in progress. In an expanded file copy example that reads and writes several files, a read error should immediately send the signal to abort writes, even writes of buffers that are still waiting in the queue.
> 
> Ok, I see. Having priority seems a good solution for this use case. I like the "tid.prioritySend(message)" approach best.

That's perfect as far as priority messages go, and should be part of the 
API. Unfortunately, I realized that thread termination is _not_ a 
priority message - it has "handle me" written all over itself, but not 
"handle me before anything else".

Andrei


More information about the dmd-concurrency mailing list