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

◆ InternalRunSynchronously() [2/2]

void System.Threading.Tasks.Task< TResult >.InternalRunSynchronously ( TaskScheduler scheduler,
bool waitForCompletion )
inlinepackageinherited

Definition at line 1550 of file Task.cs.

1551 {
1554 if ((taskCreationOptions & (TaskCreationOptions)512) != 0)
1555 {
1556 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Task_RunSynchronously_Continuation);
1557 }
1558 if ((taskCreationOptions & (TaskCreationOptions)1024) != 0)
1559 {
1560 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Task_RunSynchronously_Promise);
1561 }
1563 {
1564 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Task_RunSynchronously_TaskCompleted);
1565 }
1566 if (Interlocked.CompareExchange(ref m_taskScheduler, scheduler, null) != null)
1567 {
1568 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Task_RunSynchronously_AlreadyStarted);
1569 }
1570 if (MarkStarted())
1571 {
1572 bool flag = false;
1573 try
1574 {
1575 if (!scheduler.TryRunInline(this, taskWasPreviouslyQueued: false))
1576 {
1577 scheduler.InternalQueueTask(this);
1578 flag = true;
1579 }
1581 {
1583 }
1584 return;
1585 }
1587 {
1588 if (!flag)
1589 {
1590 TaskSchedulerException ex = new TaskSchedulerException(innerException);
1594 throw ex;
1595 }
1596 throw;
1597 }
1598 }
1599 ThrowHelper.ThrowInvalidOperationException(ExceptionResource.Task_RunSynchronously_TaskCompleted);
1600 }
volatile TaskExceptionHolder m_exceptionsHolder
Definition Task.cs:458
ContingentProperties m_contingentProperties
Definition Task.cs:964
TaskScheduler m_taskScheduler
Definition Task.cs:952
volatile int m_stateFlags
Definition Task.cs:954
void Finish(bool userDelegateExecute)
Definition Task.cs:1839
static bool IsCompletedMethod(int flags)
Definition Task.cs:1652
AggregateException? Exception
Definition Task.cs:1014
static TaskCreationOptions OptionsMethod(int flags)
Definition Task.cs:1369
void AddException(object exceptionObject)
Definition Task.cs:1740
CancellationToken CancellationToken
Definition Task.cs:1082
bool SpinThenBlockingWait(int millisecondsTimeout, CancellationToken cancellationToken)
Definition Task.cs:2361

References System.Threading.Tasks.Task< TResult >.AddException(), System.Threading.Interlocked.CompareExchange(), System.Threading.Tasks.Task< TResult >.Finish(), System.Threading.Tasks.Task< TResult >.IsCompleted, System.Threading.Tasks.Task< TResult >.IsCompletedMethod(), System.Threading.Tasks.Task< TResult >.m_contingentProperties, System.Threading.Tasks.Task< TResult >.ContingentProperties.m_exceptionsHolder, System.Threading.Tasks.Task< TResult >.m_stateFlags, System.Threading.Tasks.Task< TResult >.m_taskScheduler, System.Threading.Tasks.Task< TResult >.MarkStarted(), System.Threading.Tasks.Task< TResult >.OptionsMethod(), System.scheduler, System.Threading.Tasks.Task< TResult >.SpinThenBlockingWait(), and System.ThrowHelper.ThrowInvalidOperationException().

Referenced by System.Threading.Tasks.TaskFactory< TResult >.FromAsyncImpl(), System.Threading.Tasks.Task< TResult >.RunSynchronously(), and System.Threading.Tasks.Task< TResult >.RunSynchronously().