[dmd-concurrency] Thread termination protocol (shutdown protocol evolved)

Michel Fortin michel.fortin at michelf.com
Thu Jan 21 10:56:18 PST 2010


Le 2010-01-21 à 13:43, Andrei Alexandrescu a écrit :

> Michel Fortin wrote:
>> Here is another idea for the "shutdown protocol".
> 
> On first read, it seems to have all desired features, the right defaults, and the right amount of aggravation for the cases that do want to ignore the defaults. Thanks Michel.

You're welcome.


> Let's discuss this some more and knock it into shape. My only mild disagreement is that people can catch Terminate to continue spawning and using threads indefinitely, but I'm willing to concede that point given that the design is otherwise coherent.

I knew you wouldn't like that. :-)

But I think you need that sometime and you shouldn't have to reinvent a separate termination system just for those cases (which includes figuring a way to prevent automatic termination messages). The fact that the default (throwing Terminate) does stop a thread makes it unlikely that someone will


> But in that case I think we should make Terminate inherit Error, not Exception. That way just writing catch (Exception e) won't catch Terminate. Agree?

I disagree about inheriting from Error: Terminate isn't an error. You're probably right that it shouldn't be an Exception, so in that case it should inherit from Throwable, not Error.


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





More information about the dmd-concurrency mailing list