title: Is it ok to await the same task from multiple threads - is await thread safe?
body: <p>Is await thread safe? It seems the Task class is thread safe so I guess awaiting it is also thread safe but I haven't found a confirmation anywhere. Also is thread safety a requirement for custom awaiter - I mean for the IsCompleted, GetAwaiter, etc. methods? I.e. if those methods are not thread safe, will await be thread safe? However, I don't expect needing a custom awaiter anytime soon.</p>
  
  <p>An example of user scenario: Let's say I have a background task which returns a result asynchronously, which is then used from multiple threads:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  
  namespace scratch1
  {
      class Foo
      {
          Task&lt;int&gt; _task;
  
          public Foo()
          {
              _task = Task.Run(async () =&gt; { await Task.Delay(5000); return 5; });
          }
  
          // Called from multiple threads
          public async Task&lt;int&gt; Bar(int i)
          {
              return (await _task) + i;
          }
      }
  
      class Program
      {
          public static void Main(string[] args)
          {
              Foo foo = new Foo();
  
              List&lt;Task&gt; tasks = new List&lt;Task&gt;();
              foreach (var i in Enumerable.Range(0, 100))
              {
                  tasks.Add(Task.Run(async () =&gt; { Console.WriteLine(await foo.Bar(i)); })); 
              }
  
              Task.WaitAll(tasks.ToArray());
          }
      }
  }
  </code></pre>