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

◆ Invoke() [1/2]

void System.Threading.Tasks.Task< TResult >.WhenAllPromise< T >.Invoke ( Task completedTask)
inline

Implements System.Threading.Tasks.ITaskCompletionAction.

Definition at line 714 of file Task.cs.

715 {
716 if (TplEventSource.Log.IsEnabled())
717 {
718 TplEventSource.Log.TraceOperationRelation(base.Id, CausalityRelation.Join);
719 }
720 if (Interlocked.Decrement(ref m_count) != 0)
721 {
722 return;
723 }
725 Task task = null;
726 for (int i = 0; i < m_tasks.Length; i++)
727 {
728 Task task2 = m_tasks[i];
729 if (task2.IsFaulted)
730 {
731 if (list == null)
732 {
734 }
735 list.AddRange(task2.GetExceptionDispatchInfos());
736 }
737 else if (task2.IsCanceled && task == null)
738 {
739 task = task2;
740 }
741 if (task2.IsWaitNotificationEnabled)
742 {
744 }
745 else
746 {
747 m_tasks[i] = null;
748 }
749 }
750 if (list != null)
751 {
753 return;
754 }
755 if (task != null)
756 {
757 TrySetCanceled(task.CancellationToken, task.GetCancellationExceptionDispatchInfo());
758 return;
759 }
760 if (TplEventSource.Log.IsEnabled())
761 {
762 TplEventSource.Log.TraceOperationEnd(base.Id, AsyncCausalityStatus.Completed);
763 }
765 {
767 }
768 TrySetResult();
769 }
static bool s_asyncDebuggingEnabled
Definition Task.cs:960
bool TrySetCanceled(CancellationToken tokenToRecord)
Definition Task.cs:2555
bool TrySetException(object exceptionObject)
Definition Task.cs:2542
void SetNotificationForWaitCompletion(bool enabled)
Definition Task.cs:1426
static void RemoveFromActiveTasks(Task task)
Definition Task.cs:1197

References System.Threading.Interlocked.Decrement(), System.list, System.Threading.Tasks.TplEventSource.Log, System.Threading.Tasks.Task< TResult >.WhenAllPromise< T >.m_count, System.Threading.Tasks.Task< TResult >.WhenAllPromise< T >.m_tasks, System.Threading.Tasks.Task< TResult >.RemoveFromActiveTasks(), System.Threading.Tasks.Task< TResult >.s_asyncDebuggingEnabled, System.Threading.Tasks.Task< TResult >.SetNotificationForWaitCompletion(), System.task, System.Threading.Tasks.Task< TResult >.TrySetCanceled(), System.Threading.Tasks.Task< TResult >.TrySetException(), and System.Threading.Tasks.Task< TResult >.TrySetResult().

Referenced by System.Threading.Tasks.Task< TResult >.WhenAllPromise< T >.WhenAllPromise(), and System.Threading.Tasks.Task< TResult >.WhenAllPromise< T >.WhenAllPromise().