title: How to Sleep a thread until callback for asynchronous function is received?
body: <p>I have a function that needs to be executed only when a callback is received from asynchronous function.</p>
  
  <p>Like</p>
  
  <p>I call asynchronous function <code>Stop()</code> and soon after that I call asynchronous function <code>Start()</code>.</p>
  
  <p>The Issue before Stop CallBack is received <code>Start()</code> is called and thus I am getting issues. Also I can not separate the calling of two functions Like I can not do this.:</p>
  
  <pre><code>public void SomeFunction()
  {
      Stop();
  }  
  
  public void Stop_CallBack(eventargs e)
  {
      Start();
  }
  </code></pre>
  
  <p>I have to do this:</p>
  
  <pre><code>public void SomeFunction()
  {
  
    Stop();
    //Do something;
  
    Start();
  }
  </code></pre>
  
  <p>but before I receive Stop call back my start() function is executed thus creating the problems for me.</p>
  
  <p>Can anyone help me out how can I solve this issue.</p>