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

◆ ConsumeAsyncIfNecessary()

void System.Threading.Tasks.Dataflow.BufferBlock< T >.ConsumeAsyncIfNecessary ( bool isReplacementReplica = false)
inlinepackage

Definition at line 243 of file BufferBlock.cs.

244 {
245 if (_targetDecliningPermanently || _boundingState.TaskForInputProcessing != null || _boundingState.PostponedMessages.Count <= 0 || !_boundingState.CountIsLessThanBound)
246 {
247 return;
248 }
249 _boundingState.TaskForInputProcessing = new Task(delegate(object state)
250 {
251 ((BufferBlock<T>)state).ConsumeMessagesLoopCore();
254 if (log.IsEnabled())
255 {
256 log.TaskLaunchedForMessageHandling(this, _boundingState.TaskForInputProcessing, DataflowEtwProvider.TaskLaunchedReason.ProcessingInputMessages, _boundingState.PostponedMessages.Count);
257 }
259 if (ex != null)
260 {
261 Task.Factory.StartNew(delegate(object exc)
262 {
264 }, ex, CancellationToken.None, Common.GetCreationOptionsForTask(), TaskScheduler.Default);
265 }
266 }
readonly BoundingStateWithPostponedAndTask< T > _boundingState
void CompleteCore(Exception exception, bool storeExceptionEvenIfAlreadyCompleting, bool revertProcessingState=false)
static Exception StartTaskSafe(Task task, TaskScheduler scheduler)
Definition Common.cs:277
static TaskCreationOptions GetCreationOptionsForTask(bool isReplacementReplica=false)
Definition Common.cs:267

References System.Threading.Tasks.Dataflow.BufferBlock< T >._boundingState, System.Threading.Tasks.Dataflow.BufferBlock< T >._source, System.Threading.Tasks.Dataflow.BufferBlock< T >._targetDecliningPermanently, System.Threading.Tasks.Dataflow.BufferBlock< T >.CompleteCore(), System.Threading.Tasks.Dataflow.Internal.SourceCore< TOutput >.DataflowBlockOptions, System.Threading.Tasks.TaskScheduler.Default, System.Threading.Tasks.Task< TResult >.Factory, System.Threading.Tasks.Dataflow.Internal.Common.GetCreationOptionsForTask(), System.Threading.Tasks.Dataflow.Internal.DataflowEtwProvider.Log, System.Threading.CancellationToken.None, System.Threading.Tasks.Dataflow.Internal.Common.StartTaskSafe(), System.state, System.Threading.Tasks.Dataflow.Internal.BoundingStateWithPostponedAndTask< TInput >.TaskForInputProcessing, and System.Threading.Tasks.Dataflow.DataflowBlockOptions.TaskScheduler.

Referenced by System.Threading.Tasks.Dataflow.BufferBlock< T >.ConsumeMessagesLoopCore(), and System.Threading.Tasks.Dataflow.BufferBlock< T >.OnItemsRemoved().