title: Is code that disposes CancellationTokenSource while tasks are canceling correct?
body: <p>I see this code in front of me and I am suspicious:</p>
  
  <pre><code>CancellationTokenSource _cts;
  
  public void Dispose();
  {
      _cts.Cancel();
      _cts.Dispose();
      _task.Wait(); //wait for the task to be canceled!?
  }
  </code></pre>
  
  <p>Is it safe to call _cts.Dispose() straight after cancel? Wouldn't that dispose of underlying resources of the CancellationTokenSource that are needed for the task being cancelled to successfully Wait on the CancellationToken, if it wanted to do so?</p>