title: Is there a way to use Task<T> as a waithandle for a future value T?
body: <p>I'd like to use Task return from a method to return a the value when it becomes available at later time, so that the caller can either block using Wait or attach a continuation or even await it. The best I can think of is this:</p>
  
  <pre><code> public class Future&lt;T&gt; {
      private ManualResetEvent mre = new ManualResetEvent();
      private T value;
      public async Task&lt;T&gt; GetTask() {
          mre.WaitOne();
          return value;
      }
      public void Return(T value) {
          this.value = value;
          mre.Set();
      }
  }
  </code></pre>
  
  <p>Main problem with that is that mre.WaitOne() is blocking, so i assume that every call to GetTask() will schedule a new thread to block. Is there a way to await a WaitHandle in an async manner or is there already a helper for building the equivalent functionality?</p>
  
  <p>Edit: Ok, is TaskCompletionSource what i'm looking for and i'm just making life hard on myself?</p>