title: Waiting for a background worker to finish without blocking UI thread
body: <p>I have an application that needs to wait for a background worker to finish before moving on. The background worker is in charge of writing some values to a USB device that initializes it. The problem with the background worker is that my main program can try to access the USB device before the background worker is finished initializing.</p>
  
  <p>While the background worker is working, the UI thread shows a "please wait" with an animated progress bar. The progress bar does <strong>not</strong> reflect how far along the background worker is, it merely 'spins'.</p>
  
  <p>I have read a few questions that say not to use a background worker, because I really don't want it to run asynchronously (which is true), however, without using a background worker, my "please wait" dialog blocks and doesn't show the animation. I have also read a lot that tells me to only use one UI thread, which then supports the use of a background worker.</p>
  
  <p>I have also tried to put the "please wait" spinner in a separate thread, but that introduces complexities and strange race conditions where the "please wait" windows tries to close before it has opened.</p>
  
  <p>What is the right way to go about this?</p>