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

◆ WaitAllCore()

static bool System.Threading.Tasks.Task< TResult >.WaitAllCore ( Task< TResult >[] tasks,
int millisecondsTimeout,
CancellationToken cancellationToken )
inlinestaticprivateinherited

Definition at line 3079 of file Task.cs.

3080 {
3081 if (tasks == null)
3082 {
3083 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
3084 }
3085 if (millisecondsTimeout < -1)
3086 {
3087 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.millisecondsTimeout);
3088 }
3089 cancellationToken.ThrowIfCancellationRequested();
3091 List<Task> list = null;
3092 List<Task> list2 = null;
3093 bool flag = false;
3094 bool flag2 = false;
3095 bool flag3 = true;
3096 for (int num = tasks.Length - 1; num >= 0; num--)
3097 {
3098 Task task = tasks[num];
3099 if (task == null)
3100 {
3101 ThrowHelper.ThrowArgumentException(ExceptionResource.Task_WaitMulti_NullTask, ExceptionArgument.tasks);
3102 }
3103 bool flag4 = task.IsCompleted;
3104 if (!flag4)
3105 {
3106 if (millisecondsTimeout != -1 || cancellationToken.CanBeCanceled)
3107 {
3108 AddToList(task, ref list, tasks.Length);
3109 }
3110 else
3111 {
3112 flag4 = task.WrappedTryRunInline() && task.IsCompleted;
3113 if (!flag4)
3114 {
3115 AddToList(task, ref list, tasks.Length);
3116 }
3117 }
3118 }
3119 if (flag4)
3120 {
3121 if (task.IsFaulted)
3122 {
3123 flag = true;
3124 }
3125 else if (task.IsCanceled)
3126 {
3127 flag2 = true;
3128 }
3129 if (task.IsWaitNotificationEnabled)
3130 {
3131 AddToList(task, ref list2, 1);
3132 }
3133 }
3134 }
3135 if (list != null)
3136 {
3138 if (flag3)
3139 {
3140 foreach (Task item in list)
3141 {
3142 if (item.IsFaulted)
3143 {
3144 flag = true;
3145 }
3146 else if (item.IsCanceled)
3147 {
3148 flag2 = true;
3149 }
3150 if (item.IsWaitNotificationEnabled)
3151 {
3152 AddToList(item, ref list2, 1);
3153 }
3154 }
3155 }
3156 GC.KeepAlive(tasks);
3157 }
3158 if (flag3 && list2 != null)
3159 {
3160 foreach (Task item2 in list2)
3161 {
3162 if (item2.NotifyDebuggerOfWaitCompletionIfNecessary())
3163 {
3164 break;
3165 }
3166 }
3167 }
3168 if (flag3 && (flag || flag2))
3169 {
3170 if (!flag)
3171 {
3172 cancellationToken.ThrowIfCancellationRequested();
3173 }
3174 foreach (Task t in tasks)
3175 {
3177 }
3178 ThrowHelper.ThrowAggregateException(exceptions);
3179 }
3180 return flag3;
3181 }
static void AddExceptionsForCompletedTask(ref List< Exception > exceptions, Task t)
Definition Task.cs:3221
static bool WaitAllBlockingCore(List< Task > tasks, int millisecondsTimeout, CancellationToken cancellationToken)
Definition Task.cs:3193

References System.Threading.Tasks.Task< TResult >.AddExceptionsForCompletedTask(), System.cancellationToken, System.exceptions, System.item, System.GC.KeepAlive(), System.list, System.millisecondsTimeout, System.task, System.tasks, System.ThrowHelper.ThrowAggregateException(), System.ThrowHelper.ThrowArgumentException(), System.ThrowHelper.ThrowArgumentNullException(), System.ThrowHelper.ThrowArgumentOutOfRangeException(), and System.Threading.Tasks.Task< TResult >.WaitAllBlockingCore().

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