Represents the producer side of a System.Threading.Tasks.Task unbound to a delegate, providing access to the consumer side through the Task property.
 public static TaskAwaiter<int> GetAwaiter(this Process process)
 {
     var tcs = new TaskCompletionSource<int>();
     process.EnableRaisingEvents = true;
     process.Exited += (s, e) => tcs.TrySetResult(process.ExitCode);
     if (process.HasExited) tcs.TrySetResult(process.ExitCode);
     return tcs.Task.GetAwaiter();
 }
 /// <summary>
 /// Creates an async-compatible countdown event.
 /// </summary>
 /// <param name="count">The number of signals this event will need before it becomes set. Must be greater than zero.</param>
 public AsyncCountdownEvent(int count)
 {
     _tcs = new TaskCompletionSource();
     _count = count;
     //Enlightenment.Trace.AsyncCountdownEvent_CountChanged(this, -1, count);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskCompletionSource"/> class with the specified state and options.
 /// </summary>
 /// <param name="state">The state to use as the underlying <see cref="Task"/>'s <see cref="IAsyncResult.AsyncState"/>.</param>
 /// <param name="creationOptions">The options to use when creating the underlying <see cref="Task"/>.</param>
 public TaskCompletionSource(object state, TaskCreationOptions creationOptions)
 {
     _tcs = new TaskCompletionSource<object>(state, creationOptions);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskCompletionSource"/> class with the specified options.
 /// </summary>
 /// <param name="creationOptions">The options to use when creating the underlying <see cref="Task"/>.</param>
 public TaskCompletionSource(TaskCreationOptions creationOptions)
 {
     _tcs = new TaskCompletionSource<object>(creationOptions);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskCompletionSource"/> class with the specified state.
 /// </summary>
 /// <param name="state">The state to use as the underlying <see cref="Task"/>'s <see cref="IAsyncResult.AsyncState"/>.</param>
 public TaskCompletionSource(object state)
 {
     _tcs = new TaskCompletionSource<object>(state);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskCompletionSource"/> class.
 /// </summary>
 public TaskCompletionSource()
 {
     _tcs = new TaskCompletionSource<object>();
 }