title: How do I Delay destruction of my process if another thread causes it to crash on windows?
body: <p>I am writing a DLL which is loaded by a proprietary program which is closed source and I have no control over. I also load a Proprietary DLL which is just as obscure. Since I sometimes have to relay commands I get through my DLLs interface to the DLL I Load with very low latency I launch a separate detached thread upon initializing my DLL and send it unformatted debug information through a lock free queue. The time consuming formating of debug output and writing to a log file is thus done asynchronously. The problem is that the process crashes inadvertently (which I am almost certain is no my fault) and I have no way of knowing what the last debug info was because my detached thread is killed by windows before it can write it to disk. </p>
  
  <p>So here is my question: </p>
  
  <ul>
  <li>Can I delay destruction in any way if the proprietary program crashes so that my detached thread runs longer before destruction?</li>
  <li>Would interprocess communication solve my problem by moving my detached thread to another process which windows would not kill? If so what method would you suggest (I have not worked with IPC much)  </li>
  <li>If I use IPC how do I know when to terminate my "debug formating process"?  </li>
  </ul>