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

◆ ReceiveCoreByLinking< TOutput >()

static Task< TOutput > System.Threading.Tasks.Dataflow.DataflowBlock.ReceiveCoreByLinking< TOutput > ( ISourceBlock< TOutput > source,
int millisecondsTimeout,
CancellationToken cancellationToken )
inlinestaticprivate

Definition at line 1428 of file DataflowBlock.cs.

1429 {
1431 try
1432 {
1433 if (cancellationToken.CanBeCanceled)
1434 {
1435 receiveTarget._externalCancellationToken = cancellationToken;
1436 receiveTarget._regFromExternalCancellationToken = cancellationToken.Register(_cancelCts, receiveTarget._cts);
1437 }
1438 if (millisecondsTimeout > 0)
1439 {
1440 receiveTarget._timer = new Timer(ReceiveTarget<TOutput>.CachedLinkingTimerCallback, receiveTarget, millisecondsTimeout, -1);
1441 }
1442 if (receiveTarget._cts.Token.CanBeCanceled)
1443 {
1444 receiveTarget._cts.Token.Register(ReceiveTarget<TOutput>.CachedLinkingCancellationCallback, receiveTarget);
1445 }
1446 IDisposable comparand = (receiveTarget._unlink = source.LinkTo(receiveTarget, DataflowLinkOptions.UnlinkAfterOneAndPropagateCompletion));
1447 if (Volatile.Read(ref receiveTarget._cleanupReserved))
1448 {
1449 Interlocked.CompareExchange(ref receiveTarget._unlink, null, comparand)?.Dispose();
1450 }
1451 }
1452 catch (Exception receivedException)
1453 {
1454 receiveTarget._receivedException = receivedException;
1455 receiveTarget.TryCleanupAndComplete(ReceiveCoreByLinkingCleanupReason.SourceProtocolError);
1456 }
1457 return receiveTarget.Task;
1458 }
static readonly Action< object > _cancelCts

References System.Threading.Tasks.Dataflow.DataflowBlock._cancelCts, System.cancellationToken, System.Threading.Interlocked.CompareExchange(), System.millisecondsTimeout, System.Threading.Volatile.Read(), System.source, System.Threading.Tasks.Dataflow.DataflowBlock.Timer, and System.Threading.Tasks.Dataflow.DataflowLinkOptions.UnlinkAfterOneAndPropagateCompletion.