Clean process exit

Dmitri via Digitalmars-d digitalmars-d at puremagic.com
Thu May 7 09:15:28 PDT 2015


I'm a D noob, so my question is perhaps naive. At work, we 
develop servers that are 24/7 and as such they don't have a clean 
exit path. Sometimes, however, I'd like to troubleshoot a process 
and use valgrind, in which case I have to come with a way of 
forcing a program's exit.

I know I can control (some) valgrind tools from outside by 
forcing a log, but it is not always the case. So more often than 
not, I end up adding some sort of debugging code to be able to 
force an exit from outside - in which case it is as simple as 
calling stdlib's exit. This poses a problem when the exit is 
called from a thread other than the main one, since it did not 
have a _d_dos_registry on the way "in", but it gets called on the 
way "out" and crashes when the _tlsRanges is modified.

My questions are,
   * is it legit to want to terminate not from the main thread?
   * if not, what is the recommended simpler way of doing it?





More information about the Digitalmars-d mailing list