title: When does windows signal a process handle?
body: <p>I have a self upgrade process implemented where my main application exe launches an updater exe passing a handle to itself on the command line. The application exe then calls ExitProcess to exit, and the updater calls WaitForSingleObject on the passed in handle to wait for the application exe to terminate.</p>
  
  <p>The WaitForSingleObject does wait. Until the application calls ExitProcess the updater does stall.</p>
  
  <p>However, sometimes, when the updater tries to overwrite the application dlls  with the new versions I get a file-locked error which the current version of my updater treats as an unrecoverable error and terminates. It seems that including an arbitrary sleep(100) is sufficient to bypass this "issue" but I really hate code like that. really hate.</p>
  
  <p>It seems very odd to me that the process handle can be signalled while the main application is still alive enough to have dll files locked.</p>