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

◆ WaitAnyCore()

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

Definition at line 3270 of file Task.cs.

3271 {
3272 if (tasks == null)
3273 {
3274 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.tasks);
3275 }
3276 if (millisecondsTimeout < -1)
3277 {
3278 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.millisecondsTimeout);
3279 }
3280 cancellationToken.ThrowIfCancellationRequested();
3281 int num = -1;
3282 for (int i = 0; i < tasks.Length; i++)
3283 {
3284 Task task = tasks[i];
3285 if (task == null)
3286 {
3287 ThrowHelper.ThrowArgumentException(ExceptionResource.Task_WaitMulti_NullTask, ExceptionArgument.tasks);
3288 }
3289 if (num == -1 && task.IsCompleted)
3290 {
3291 num = i;
3292 }
3293 }
3294 if (num == -1 && tasks.Length != 0)
3295 {
3296 Task<Task> task2 = TaskFactory.CommonCWAnyLogic(tasks, isSyncBlocking: true);
3298 {
3299 num = Array.IndexOf(tasks, task2.Result);
3300 }
3301 else
3302 {
3303 TaskFactory.CommonCWAnyLogicCleanup(task2);
3304 }
3305 }
3306 GC.KeepAlive(tasks);
3307 return num;
3308 }

References System.cancellationToken, System.Threading.Tasks.TaskFactory< TResult >.CommonCWAnyLogic(), System.Threading.Tasks.TaskFactory< TResult >.CommonCWAnyLogicCleanup(), System.Array.IndexOf(), System.GC.KeepAlive(), System.millisecondsTimeout, System.task, System.tasks, System.ThrowHelper.ThrowArgumentException(), System.ThrowHelper.ThrowArgumentNullException(), and System.ThrowHelper.ThrowArgumentOutOfRangeException().

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