コード例 #1
0
ファイル: YieldAwaitable.cs プロジェクト: wwkkww1983/ZJCredit
            private static Action OutputCorrelationEtwEvent(Action continuation)
            {
                int  continuationId  = Task.NewId();
                Task internalCurrent = Task.InternalCurrent;

                TplEtwProvider.Log.AwaitTaskContinuationScheduled(TaskScheduler.Current.Id, internalCurrent != null ? internalCurrent.Id : 0, continuationId);
                return(AsyncMethodBuilderCore.CreateContinuationWrapper(continuation, (Action)(() =>
                {
                    TplEtwProvider tplEtwProvider = TplEtwProvider.Log;
                    int TaskID1 = continuationId;
                    tplEtwProvider.TaskWaitContinuationStarted(TaskID1);
                    Guid oldActivityThatWillContinue = new Guid();
                    if (tplEtwProvider.TasksSetActivityIds)
                    {
                        EventSource.SetCurrentThreadActivityId(TplEtwProvider.CreateGuidForTaskID(continuationId), out oldActivityThatWillContinue);
                    }
                    continuation();
                    if (tplEtwProvider.TasksSetActivityIds)
                    {
                        EventSource.SetCurrentThreadActivityId(oldActivityThatWillContinue);
                    }
                    int TaskID2 = continuationId;
                    tplEtwProvider.TaskWaitContinuationComplete(TaskID2);
                }), (Task)null));
            }
コード例 #2
0
            // Token: 0x06006FE1 RID: 28641 RVA: 0x0018064C File Offset: 0x0017E84C
            private static Action OutputCorrelationEtwEvent(Action continuation)
            {
                int  continuationId  = Task.NewId();
                Task internalCurrent = Task.InternalCurrent;

                TplEtwProvider.Log.AwaitTaskContinuationScheduled(TaskScheduler.Current.Id, (internalCurrent != null) ? internalCurrent.Id : 0, continuationId);
                return(AsyncMethodBuilderCore.CreateContinuationWrapper(continuation, delegate
                {
                    TplEtwProvider log = TplEtwProvider.Log;
                    log.TaskWaitContinuationStarted(continuationId);
                    Guid currentThreadActivityId = default(Guid);
                    if (log.TasksSetActivityIds)
                    {
                        EventSource.SetCurrentThreadActivityId(TplEtwProvider.CreateGuidForTaskID(continuationId), out currentThreadActivityId);
                    }
                    continuation();
                    if (log.TasksSetActivityIds)
                    {
                        EventSource.SetCurrentThreadActivityId(currentThreadActivityId);
                    }
                    log.TaskWaitContinuationComplete(continuationId);
                }, null));
            }