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

◆ GetStateMachineBox< TStateMachine >()

static IAsyncStateMachineBox System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder< TResult >.GetStateMachineBox< TStateMachine > ( ref TStateMachine stateMachine,
[NotNull] ref StateMachineBox boxFieldRef )
inlinestaticprivate
Type Constraints
TStateMachine :IAsyncStateMachine 

Definition at line 339 of file PoolingAsyncValueTaskMethodBuilder.cs.

339 : IAsyncStateMachine
340 {
341 ExecutionContext executionContext = ExecutionContext.Capture();
342 if (boxFieldRef is StateMachineBox<TStateMachine> stateMachineBox)
343 {
344 if (stateMachineBox.Context != executionContext)
345 {
346 stateMachineBox.Context = executionContext;
347 }
348 return stateMachineBox;
349 }
350 if (boxFieldRef is StateMachineBox<IAsyncStateMachine> stateMachineBox2)
351 {
352 if (stateMachineBox2.StateMachine == null)
353 {
355 stateMachineBox2.StateMachine = stateMachine;
356 }
357 stateMachineBox2.Context = executionContext;
358 return stateMachineBox2;
359 }
361 StateMachineBox<TStateMachine> stateMachineBox3 = (StateMachineBox<TStateMachine>)(boxFieldRef = StateMachineBox<TStateMachine>.RentFromCache());
362 stateMachineBox3.StateMachine = stateMachine;
363 stateMachineBox3.Context = executionContext;
364 return stateMachineBox3;
365 }
static void NotifyOfCrossThreadDependency()
Definition Debugger.cs:44
static ? ExecutionContext Capture()

References System.Threading.ExecutionContext.Capture(), System.Diagnostics.Debugger.NotifyOfCrossThreadDependency(), and System.stateMachine.