2using System.Threading.Tasks;
16 protected readonly TaskCompletionSource<ReturnType>
task;
19 private readonly Arg1Type arg1;
28 this.task =
new TaskCompletionSource<ReturnType>();
29 this.callback = Callback;
40 this.task.TrySetResult(this.callback(this.arg1));
44 this.task.TrySetException(ex);
52 public Task<ReturnType>
WaitAsync() => this.task.Task;
Task with one argument to be synchronized.
SyncTask1(Callback1< ReturnType, Arg1Type > Callback, Arg1Type Arg1)
Task to be synchronized.
void Execute()
Executes the task.
readonly TaskCompletionSource< ReturnType > task
Task completion source, waiting for the result of the task.
Task< ReturnType > WaitAsync()
Waits for the task to complete.
Interface for tasks to be synckronized.
delegate ReturnType Callback1< ReturnType, Arg1Type >(Arg1Type Arg1)
Delegate to methods of one parameter and a given return type.