title: Run Message Loop while waiting for WaitHandle
body: <p>Is there any way to process all Windows messages while the UI thread is waiting on a WaitHandle or other threading primitive?</p>
  
  <p>I realize that it could create very messy reentrancy problems; I want to do it anyway.</p>
  
  <p><b>EDIT</b>: The wait occurs in the middle of a complicated function that must run on the UI thread.  Therefore, moving the wait to a background thread is not an option.  (Splitting the function in two would make a complicated and unmaintainable mess)</p>