Exemplo n.º 1
0
 public Task <TResult> ContinueWhenAny(Task[] tasks,
                                       Func <Task, TResult> continuationFunction,
                                       CancellationToken cancellationToken,
                                       TaskContinuationOptions continuationOptions,
                                       TaskScheduler scheduler)
 {
     return(parent.ContinueWhenAny(tasks, continuationFunction, cancellationToken, continuationOptions, scheduler));
 }
 /// <summary>
 /// Creates a continuation <see cref="Task"/> that will complete upon
 /// the completion of any one of a set of provided <see cref="Task"/>s.
 /// </summary>
 /// <param name="factory">The <see cref="TaskFactory"/> to use to create the continuation task.</param>
 /// <param name="tasks">The array of tasks from which to continue.</param>
 /// <returns>A <see cref="Task"/> that, when completed, will return the completed task.</returns>
 public static Task <Task <TAntecedentResult> > WhenAny <TAntecedentResult>(
     this TaskFactory factory, params Task <TAntecedentResult>[] tasks)
 {
     return(factory.ContinueWhenAny(tasks, completedTask => completedTask));
 }
 /// <summary>
 /// Creates a continuation <see cref="Task"/> that will complete upon
 /// the completion of any one of a set of provided <see cref="Task"/>s.
 /// </summary>
 /// <param name="factory">The <see cref="TaskFactory"/> to use to create the continuation task.</param>
 /// <param name="tasks">The array of tasks from which to continue.</param>
 /// <returns>A <see cref="Task"/> that, when completed, will return the completed task.</returns>
 public static Task <Task> WhenAny(
     this TaskFactory factory, params Task[] tasks)
 {
     return(factory.ContinueWhenAny(tasks, completedTask => completedTask));
 }
        public Task <TResult> ContinueWhenAny <TAntecedentResult>(Task <TAntecedentResult>[] tasks, Func <Task <TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
        {
            StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;

            return(TaskFactory <TResult> .ContinueWhenAny <TAntecedentResult>(tasks, continuationFunction, continuationOptions, cancellationToken, scheduler, ref lookForMyCaller));
        }
        public Task <TResult> ContinueWhenAny <TAntecedentResult>(Task <TAntecedentResult>[] tasks, Func <Task <TAntecedentResult>, TResult> continuationFunction, TaskContinuationOptions continuationOptions)
        {
            StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;

            return(TaskFactory <TResult> .ContinueWhenAny <TAntecedentResult>(tasks, continuationFunction, continuationOptions, this.m_defaultCancellationToken, this.DefaultScheduler, ref lookForMyCaller));
        }
        public Task <TResult> ContinueWhenAny(Task[] tasks, Func <Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken)
        {
            StackCrawlMark lookForMyCaller = StackCrawlMark.LookForMyCaller;

            return(TaskFactory <TResult> .ContinueWhenAny(tasks, continuationFunction, this.m_defaultContinuationOptions, cancellationToken, this.DefaultScheduler, ref lookForMyCaller));
        }