Add a clean way to exit a process

Sean Kelly sean at invisibleduck.org
Sun Nov 1 09:23:39 PST 2009


I've thought about doing this before, but I haven't come up with a clean way to do it yet.  The problem with simply throwing an exception is that this would only work in the main thread.  To allow other threads to terminate the process you'd have to forcibly terminate other threads, and then running dtors would result in undefined behavior.  I'd considered sending signals to all threads and having them all throw exceptions, but it's illegal to throw an exception from a signal hander, and Windows has poor signal support anyway.  Sadly, I don't know of a better solution than simply calling exit() right now.



More information about the Digitalmars-d mailing list