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

◆ ProcessMessageWithTask()

void System.Threading.Tasks.Dataflow.TransformBlock< TInput, TOutput >.ProcessMessageWithTask ( Func< TInput, Task< TOutput > > transform,
KeyValuePair< TInput, long > messageWithId )
inlineprivate

Definition at line 208 of file TransformBlock.cs.

209 {
210 Task<TOutput> task = null;
211 Exception ex = null;
212 try
213 {
214 task = transform(messageWithId.Key);
215 }
216 catch (Exception ex2)
217 {
218 ex = ex2;
219 }
220 if (task == null)
221 {
222 if (ex != null && !Common.IsCooperativeCancellation(ex))
223 {
224 Common.StoreDataflowMessageValueIntoExceptionData(ex, messageWithId.Key);
226 }
227 if (_reorderingBuffer != null)
228 {
229 _reorderingBuffer.IgnoreItem(messageWithId.Value);
230 }
231 _target.SignalOneAsyncMessageCompleted(-1);
232 }
233 else
234 {
235 task.ContinueWith(delegate(Task<TOutput> completed, object state)
236 {
238 tuple.Item1.AsyncCompleteProcessMessageWithTask(completed, tuple.Item2);
239 }, Tuple.Create(this, messageWithId), CancellationToken.None, Common.GetContinuationOptions(TaskContinuationOptions.ExecuteSynchronously), TaskScheduler.Default);
240 }
241 }
static bool IsCooperativeCancellation(Exception exception)
Definition Common.cs:88
static TaskContinuationOptions GetContinuationOptions(TaskContinuationOptions toInclude=TaskContinuationOptions.None)
Definition Common.cs:262
readonly ReorderingBuffer< TOutput > _reorderingBuffer

References System.Threading.Tasks.Dataflow.TransformBlock< TInput, TOutput >._reorderingBuffer, System.Threading.Tasks.Dataflow.TransformBlock< TInput, TOutput >._target, System.Threading.Tasks.TaskScheduler.Default, System.Threading.Tasks.Dataflow.Internal.Common.GetContinuationOptions(), System.Threading.Tasks.Dataflow.Internal.Common.IsCooperativeCancellation(), System.Threading.CancellationToken.None, System.state, and System.task.