ctrl+c and destructors
qznc
qznc at web.de
Wed Oct 2 02:16:43 PDT 2013
On Tuesday, 1 October 2013 at 11:48:51 UTC, w0rp wrote:
> This is a really good question, I think! Python has a
> KeyboardInterrupt exception for this purpose. Should we perhap
> try something similar? Perhaps as a library solution? I think a
> function like some_module.registerInterruptExceptions() would
> be cool to have. If someone knows a way to do that, that would
> be cool. I'm looking at deadalnix...
I don't like where this is headed. Converting signals into
exceptions is a bad idea.
In a multithreaded program, which thread should get the exception
thrown? The main thread? Every thread? What if main already
terminated?
The InterruptException must be anticipated in lots of places and
most people will forget about it.
Basically, the issues are very similar to killing threads [0].
Throwing exception anywhere without any relation to the code at
that point is a recipe for disaster.
[0]
http://docs.oracle.com/javase/1.5.0/docs/guide/misc/threadPrimitiveDeprecation.html
More information about the Digitalmars-d
mailing list