Best way to wait for a background thread to finish processing in C#
<p>I have a background thread. If the background thread is busy, I want to wait for it to finish its work and then continue with next request. I have implemented it in the following way. Process is the name of the background thread.</p>

<pre><code> if (process.IsBusy)
 {
     do
     {
         isProcessBusy = process.IsBusy;
     } while (isProcessBusy == false);

     SetIsDirty(status, GetContext());
 }
 else
 {
     SetIsDirty(status, GetContext());
 }
</code></pre>

<p>Is this the best way or are there other ways to implement this kind of logic?</p>
