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

◆ ProcessAsyncIfNecessary()

void System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ProcessAsyncIfNecessary ( bool fairly = false)
inlineprivate

Definition at line 404 of file ConcurrentExclusiveSchedulerPair.cs.

405 {
406 if (m_processingCount < 0)
407 {
408 return;
409 }
410 bool flag = !m_exclusiveTaskScheduler.m_tasks.IsEmpty;
411 Task task = null;
412 if (m_processingCount == 0 && flag)
413 {
416 {
417 try
418 {
419 task = new Task(delegate(object thisPair)
420 {
421 ((ConcurrentExclusiveSchedulerPair)thisPair).ProcessExclusiveTasks();
422 }, this, default(CancellationToken), GetCreationOptionsForTask(fairly));
424 }
425 catch (Exception exception)
426 {
428 FaultWithTask(task ?? Task.FromException(exception));
429 }
430 }
431 }
432 else
433 {
435 if (count > 0 && !flag && m_processingCount < m_maxConcurrencyLevel)
436 {
437 for (int i = 0; i < count; i++)
438 {
440 {
441 break;
442 }
445 {
446 continue;
447 }
448 try
449 {
450 task = new Task(delegate(object thisPair)
451 {
452 ((ConcurrentExclusiveSchedulerPair)thisPair).ProcessConcurrentTasks();
453 }, this, default(CancellationToken), GetCreationOptionsForTask(fairly));
455 }
456 catch (Exception exception2)
457 {
459 FaultWithTask(task ?? Task.FromException(exception2));
460 }
461 }
462 }
463 }
465 }
static TaskCreationOptions GetCreationOptionsForTask(bool isReplacementReplica=false)

References System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ConcurrentExclusiveSchedulerPair(), System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.CleanupStateIfCompletingAndQuiesced(), System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.exception, System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.FaultWithTask(), System.Threading.Tasks.Task< TResult >.FromException(), System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.GetCreationOptionsForTask(), System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.m_concurrentTaskScheduler, System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.m_exclusiveTaskScheduler, System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.m_maxConcurrencyLevel, System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.m_processingCount, System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ConcurrentExclusiveTaskScheduler.m_tasks, System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.m_underlyingTaskScheduler, System.Threading.Tasks.Task< TResult >.Start(), System.task, and System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.TryQueueThreadPoolWorkItem().

Referenced by System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ProcessConcurrentTasks(), System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ProcessExclusiveTasks(), and System.Threading.Tasks.ConcurrentExclusiveSchedulerPair.ConcurrentExclusiveTaskScheduler.QueueTask().