Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ContinueWithTaskContinuation.cs
Go to the documentation of this file.
2
4{
5 internal Task m_task;
6
8
9 private readonly TaskScheduler m_taskScheduler;
10
12 {
13 m_task = task;
16 if (TplEventSource.Log.IsEnabled())
17 {
18 TplEventSource.Log.TraceOperationBegin(m_task.Id, "Task.ContinueWith: " + task.m_action.Method.Name, 0L);
19 }
21 {
23 }
24 }
25
26 internal override void Run(Task completedTask, bool canInlineContinuationTask)
27 {
29 m_task = null;
31 if (completedTask.IsCompletedSuccessfully ? ((options & TaskContinuationOptions.NotOnRanToCompletion) == 0) : (completedTask.IsCanceled ? ((options & TaskContinuationOptions.NotOnCanceled) == 0) : ((options & TaskContinuationOptions.NotOnFaulted) == 0)))
32 {
33 if (TplEventSource.Log.IsEnabled() && !task.IsCanceled)
34 {
35 TplEventSource.Log.TraceOperationRelation(task.Id, CausalityRelation.AssignDelegate);
36 }
37 task.m_taskScheduler = m_taskScheduler;
38 if (!canInlineContinuationTask || (options & TaskContinuationOptions.ExecuteSynchronously) == 0)
39 {
40 try
41 {
42 task.ScheduleAndStart(needsProtection: true);
43 return;
44 }
46 {
47 return;
48 }
49 }
51 }
52 else
53 {
54 Task.ContingentProperties contingentProperties = task.m_contingentProperties;
55 if (contingentProperties == null || contingentProperties.m_cancellationToken == default(CancellationToken))
56 {
57 task.InternalCancelContinueWithInitialState();
58 }
59 else
60 {
61 task.InternalCancel();
62 }
63 }
64 }
65
67 {
68 if (m_task != null)
69 {
70 if ((object)m_task.m_action != null)
71 {
72 return new Delegate[1] { m_task.m_action };
73 }
75 }
76 return null;
77 }
78}
override void Run(Task completedTask, bool canInlineContinuationTask)
ContinueWithTaskContinuation(Task task, TaskContinuationOptions options, TaskScheduler scheduler)
static void InlineIfPossibleOrElseQueue(Task task, bool needsProtection)
static bool s_asyncDebuggingEnabled
Definition Task.cs:960
virtual Delegate[] GetDelegateContinuationsForDebugger()
Definition Task.cs:3770
static bool AddToActiveTasks(Task task)
Definition Task.cs:1186
static readonly TplEventSource Log