title: How do nested calls of async functions work?
body: <p>I am new in async programming and my question might look silly. Can anybody, please, explain how async calls work in the following pseudo code example?</p>
  
  <pre><code>    public async Task MyMethod()
      {
       while(true)
       {
        await Method1();
        //do something in MyMethod 
        await Task.Delay(10000);
       }
      }
  
      private async Task Method1()
      {
      //do something in Method1 before await
      await Method2();
      //do something in Method1 after await
      }
  
      private async Task Method2()
      {
      //do something in Method2 before await
      await LongRunMethod();
      }
  </code></pre>
  
  <p>In my understanding, the program works like this</p>
  
  <ol>
  <li>MyMethod() calls Method1() in infinite loop</li>
  <li>Method1() runs "do something in Method1 before await"</li>
  <li>Method1() starts Method2() and returns control to MyMethod()</li>
  <li>MyMethod() starts 10000 ms delay and returns control to its caller</li>
  <li>Method2() completes "do something in Method2 before await", starts LongRunMethod() and returns control to MyMethod1()</li>
  <li>Method1() completes "do something in Method1 after await". What method does get control after that?</li>
  <li>LongRunMethod() finishes its work</li>
  <li>Method2() finishes its work. Does it return control to Method1()?</li>
  <li>After 10000ms, everything repeats from step 1. </li>
  </ol>
  
  <p>My questions are </p>
  
  <ol>
  <li>Is the above steps sequence correct?</li>
  <li>What methods do get control after Method1() and Method2() finish their work in steps 6 and 8?</li>
  <li>What is going to happen if LongRunMethod() runs longer than 10000ms?</li>
  </ol>
  
  <p>Thank you</p>