title: How to pass booleon back from Worker_ProgressChanged to Worker_DoWork
body: <p>I'm using a Background worker to read values in and to pass values to Worker_ProgressChanged, to update UI.</p>
  
  <p>In Worker_DoWork:</p>
  
  <pre><code>while (agi.DvmReadyToRead)   // wait for digipot to be adjusted before reading in worker
  {
      Thread.Sleep(20);
      Application.DoEvents();
      //logS.Debug("Waiting for ready to read in worker");
  }
  Thread.Sleep(40);  // Give digipot chance to make the change
  agi.SendSoftwareTriggerOne();
  Thread.Sleep(7);    // Duration for above command to execute
  A = agi.ReadOne();
  Thread.Sleep(1);    
  agi.InitOne();
  Thread.Sleep(1);    
  sAndH3 = A[0];
  worker.ReportProgress(0, new System.Tuple&lt;double&gt;(sAndH3));
  agi.DvmReadyToRead = true;
  </code></pre>
  
  <p>In Worker_ProgressChanged:</p>
  
  <pre><code>while (!agi.DvmReadyToRead)
  {
      //logS.Debug("waiting for ready to read in progress");
      Thread.Sleep(0);
      Thread.Sleep(0);
      Thread.Sleep(0);
      Thread.Sleep(0);
      Thread.Sleep(0);
      Application.DoEvents();  // Exception thown here
      Thread.Sleep(1);     // wait for DVM reading
  }
  agi.DvmReadyToRead = false;
  
  // Then goes on to adjust output voltage up or down
  </code></pre>
  
  <p>This is working fine the first time round using </p>
  
  <pre><code>Application.DoEvents();
  </code></pre>
  
  <p>however after first run, I get a stackoverflow at this point. After reading many posts on here DoEvents is not the best way of doing what I am trying to achieve.
  So what I would like is a way to pass a Boolean back to DoWork, or another way to allow worker to be able to read the agi.DvmReadyToRead Boolean.</p>
  
  <p>Thanks!</p>