private void ExecuteWorkItemHelper() { TplEtwProvider tplEtwProvider = TplEtwProvider.Log; Guid oldActivityThatWillContinue = Guid.Empty; if (tplEtwProvider.TasksSetActivityIds && this.m_continuationId != 0) { EventSource.SetCurrentThreadActivityId(TplEtwProvider.CreateGuidForTaskID(this.m_continuationId), out oldActivityThatWillContinue); } try { if (this.m_capturedContext == null) { this.m_action(); } else { try { ExecutionContext.Run(this.m_capturedContext, AwaitTaskContinuation.GetInvokeActionCallback(), (object)this.m_action, true); } finally { this.m_capturedContext.Dispose(); } } } finally { if (tplEtwProvider.TasksSetActivityIds && this.m_continuationId != 0) { EventSource.SetCurrentThreadActivityId(oldActivityThatWillContinue); } } }
internal sealed override void Run(Task task, bool canInlineContinuationTask) { if (canInlineContinuationTask && this.m_syncContext == SynchronizationContext.CurrentNoFlow) { base.RunCallback(AwaitTaskContinuation.GetInvokeActionCallback(), this.m_action, ref Task.t_currentTask); return; } TplEtwProvider log = TplEtwProvider.Log; if (log.IsEnabled()) { this.m_continuationId = Task.NewId(); log.AwaitTaskContinuationScheduled((task.ExecutingTaskScheduler ?? TaskScheduler.Default).Id, task.Id, this.m_continuationId); } base.RunCallback(SynchronizationContextAwaitTaskContinuation.GetPostActionCallback(), this, ref Task.t_currentTask); }
internal override void Run(Task task, bool canInlineContinuationTask) { if (canInlineContinuationTask && AwaitTaskContinuation.IsValidLocationForInlining) { this.RunCallback(AwaitTaskContinuation.GetInvokeActionCallback(), this.m_action, ref Task.t_currentTask); return; } TplEtwProvider log = TplEtwProvider.Log; if (log.IsEnabled()) { this.m_continuationId = Task.NewId(); log.AwaitTaskContinuationScheduled((task.ExecutingTaskScheduler ?? TaskScheduler.Default).Id, task.Id, this.m_continuationId); } ThreadPool.UnsafeQueueCustomWorkItem(this, false); }
internal override sealed void Run(Task task, bool canInlineContinuationTask) { if (canInlineContinuationTask && this.m_syncContext == SynchronizationContext.CurrentNoFlow) { this.RunCallback(AwaitTaskContinuation.GetInvokeActionCallback(), (object)this.m_action, ref Task.t_currentTask); } else { TplEtwProvider tplEtwProvider = TplEtwProvider.Log; if (tplEtwProvider.IsEnabled()) { this.m_continuationId = Task.NewId(); tplEtwProvider.AwaitTaskContinuationScheduled((task.ExecutingTaskScheduler ?? TaskScheduler.Default).Id, task.Id, this.m_continuationId); } this.RunCallback(SynchronizationContextAwaitTaskContinuation.GetPostActionCallback(), (object)this, ref Task.t_currentTask); } }
private void ExecuteWorkItemHelper() { TplEtwProvider log = TplEtwProvider.Log; Guid empty = Guid.Empty; if (log.TasksSetActivityIds && this.m_continuationId != 0) { Guid activityId = TplEtwProvider.CreateGuidForTaskID(this.m_continuationId); EventSource.SetCurrentThreadActivityId(activityId, out empty); } try { if (this.m_capturedContext == null) { this.m_action(); } else { try { ExecutionContext.Run(this.m_capturedContext, AwaitTaskContinuation.GetInvokeActionCallback(), this.m_action, true); } finally { this.m_capturedContext.Dispose(); } } } finally { if (log.TasksSetActivityIds && this.m_continuationId != 0) { EventSource.SetCurrentThreadActivityId(empty); } } }