Exemplo n.º 1
0
        // Token: 0x06004053 RID: 16467 RVA: 0x000EFBD4 File Offset: 0x000EDDD4
        internal override void Run(Task completedTask, bool bCanInlineContinuationTask)
        {
            TaskContinuationOptions options = this.m_options;
            bool flag = completedTask.IsRanToCompletion ? ((options & TaskContinuationOptions.NotOnRanToCompletion) == TaskContinuationOptions.None) : (completedTask.IsCanceled ? ((options & TaskContinuationOptions.NotOnCanceled) == TaskContinuationOptions.None) : ((options & TaskContinuationOptions.NotOnFaulted) == TaskContinuationOptions.None));
            Task task = this.m_task;

            if (flag)
            {
                if (!task.IsCanceled && AsyncCausalityTracer.LoggingOn)
                {
                    AsyncCausalityTracer.TraceOperationRelation(CausalityTraceLevel.Important, task.Id, CausalityRelation.AssignDelegate);
                }
                task.m_taskScheduler = this.m_taskScheduler;
                if (bCanInlineContinuationTask && (options & TaskContinuationOptions.ExecuteSynchronously) != TaskContinuationOptions.None)
                {
                    TaskContinuation.InlineIfPossibleOrElseQueue(task, true);
                    return;
                }
                try
                {
                    task.ScheduleAndStart(true);
                    return;
                }
                catch (TaskSchedulerException)
                {
                    return;
                }
            }
            task.InternalCancel(false);
        }
Exemplo n.º 2
0
        // Token: 0x0600405C RID: 16476 RVA: 0x000EFE3C File Offset: 0x000EE03C
        internal sealed override void Run(Task ignored, bool canInlineContinuationTask)
        {
            if (this.m_scheduler == TaskScheduler.Default)
            {
                base.Run(ignored, canInlineContinuationTask);
                return;
            }
            bool flag = canInlineContinuationTask && (TaskScheduler.InternalCurrent == this.m_scheduler || Thread.CurrentThread.IsThreadPoolThread);
            Task task = base.CreateTask(delegate(object state)
            {
                try
                {
                    ((Action)state)();
                }
                catch (Exception exc)
                {
                    AwaitTaskContinuation.ThrowAsyncIfNecessary(exc);
                }
            }, this.m_action, this.m_scheduler);

            if (flag)
            {
                TaskContinuation.InlineIfPossibleOrElseQueue(task, false);
                return;
            }
            try
            {
                task.ScheduleAndStart(false);
            }
            catch (TaskSchedulerException)
            {
            }
        }
Exemplo n.º 3
0
 internal override sealed void Run(Task ignored, bool canInlineContinuationTask)
 {
     if (this.m_scheduler == TaskScheduler.Default)
     {
         base.Run(ignored, canInlineContinuationTask);
     }
     else
     {
         int  num  = !canInlineContinuationTask ? 0 : (TaskScheduler.InternalCurrent == this.m_scheduler ? 1 : (Thread.CurrentThread.IsThreadPoolThread ? 1 : 0));
         Task task = this.CreateTask((Action <object>)(state =>
         {
             try
             {
                 ((Action)state)();
             }
             catch (Exception ex)
             {
                 AwaitTaskContinuation.ThrowAsyncIfNecessary(ex);
             }
         }), (object)this.m_action, this.m_scheduler);
         if (num != 0)
         {
             TaskContinuation.InlineIfPossibleOrElseQueue(task, false);
         }
         else
         {
             try
             {
                 task.ScheduleAndStart(false);
             }
             catch (TaskSchedulerException ex)
             {
             }
         }
     }
 }