Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ RunContinuations()

void System.Threading.Tasks.Task< TResult >.RunContinuations ( object continuationObject)
inlineprivateinherited

Definition at line 2581 of file Task.cs.

2582 {
2583 TplEventSource log = TplEventSource.Log;
2584 bool flag = log.IsEnabled();
2585 if (flag)
2586 {
2587 log.TraceSynchronousWorkBegin(Id, CausalitySynchronousWork.CompletionNotification);
2588 }
2591 {
2592 if (!(continuationObject is Action action))
2593 {
2594 if (!(continuationObject is TaskContinuation taskContinuation))
2595 {
2596 if (continuationObject is ITaskCompletionAction completionAction)
2597 {
2600 return;
2601 }
2603 lock (list)
2604 {
2605 }
2606 int count = list.Count;
2607 if (flag2)
2608 {
2609 bool flag3 = false;
2610 for (int i = 0; i < count; i++)
2611 {
2612 object obj = list[i];
2613 if (obj == null)
2614 {
2615 continue;
2616 }
2617 if (obj is ContinueWithTaskContinuation continueWithTaskContinuation)
2618 {
2619 if ((continueWithTaskContinuation.m_options & TaskContinuationOptions.ExecuteSynchronously) == 0)
2620 {
2621 list[i] = null;
2622 if (flag)
2623 {
2624 log.RunningContinuationList(Id, i, continueWithTaskContinuation);
2625 }
2627 }
2628 }
2629 else
2630 {
2631 if (obj is ITaskCompletionAction)
2632 {
2633 continue;
2634 }
2635 if (flag3)
2636 {
2637 list[i] = null;
2638 if (flag)
2639 {
2640 log.RunningContinuationList(Id, i, obj);
2641 }
2643 {
2644 if (obj is Action action2)
2645 {
2646 AwaitTaskContinuation.RunOrScheduleAction(action2, allowInlining: false);
2647 }
2648 else
2649 {
2650 ((TaskContinuation)obj).Run(this, canInlineContinuationTask: false);
2651 }
2652 }
2653 else
2654 {
2655 AwaitTaskContinuation.RunOrScheduleAction(box2, allowInlining: false);
2656 }
2657 }
2658 flag3 = true;
2659 }
2660 }
2661 }
2662 for (int j = 0; j < count; j++)
2663 {
2664 object obj2 = list[j];
2665 if (obj2 == null)
2666 {
2667 continue;
2668 }
2669 list[j] = null;
2670 if (flag)
2671 {
2672 log.RunningContinuationList(Id, j, obj2);
2673 }
2675 {
2676 if (!(obj2 is Action action3))
2677 {
2678 if (obj2 is TaskContinuation taskContinuation2)
2679 {
2680 taskContinuation2.Run(this, flag2);
2681 }
2682 else
2683 {
2684 RunOrQueueCompletionAction((ITaskCompletionAction)obj2, flag2);
2685 }
2686 }
2687 else
2688 {
2689 AwaitTaskContinuation.RunOrScheduleAction(action3, flag2);
2690 }
2691 }
2692 else
2693 {
2694 AwaitTaskContinuation.RunOrScheduleAction(box3, flag2);
2695 }
2696 }
2698 }
2699 else
2700 {
2701 taskContinuation.Run(this, flag2);
2703 }
2704 }
2705 else
2706 {
2707 AwaitTaskContinuation.RunOrScheduleAction(action, flag2);
2709 }
2710 }
2711 else
2712 {
2713 AwaitTaskContinuation.RunOrScheduleAction(box, flag2);
2715 }
2716 }
static void LogFinishCompletionNotification()
Definition Task.cs:2730
volatile int m_stateFlags
Definition Task.cs:954
void RunOrQueueCompletionAction(ITaskCompletionAction completionAction, bool allowInlining)
Definition Task.cs:2718

References System.action, System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Threading.Tasks.Task< TResult >.Id, System.list, System.Threading.Tasks.TplEventSource.Log, System.Threading.Tasks.Task< TResult >.LogFinishCompletionNotification(), System.Threading.Tasks.Task< TResult >.m_stateFlags, System.obj, System.Threading.Tasks.Task< TResult >.RunOrQueueCompletionAction(), System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(), and System.Runtime.CompilerServices.RuntimeHelpers.TryEnsureSufficientExecutionStack().

Referenced by System.Threading.Tasks.Task< TResult >.FinishContinuations().