What does SynchronizationContext execute Task.ContinueWith to use?

Some task.ContinueWith overloads do not use SynchronizationContext. What do they use SynchronizationContext to schedule a new task?

+4
source share
2 answers

Some Task.Continue Overloads You do not use SynchronizationContext.

Actually, not one of them accepts SynchronizationContext, but some take TaskScheduler.

What do they use SynchronizationContext to schedule a new task?

! (TaskScheduler.Current), , Task, TaskScheduler.Default. , . ThreadPool ( ).

+7

ContinueWith TaskScheduler.Current , Reference Source.

, () TaskScheduler.Default, , . , TaskCreationOptions.HideScheduler TaskContinuationOptions.HideScheduler, .NET 4.5.

, Task.Factory.StartNew Task.ContinueWith. TaskScheduler.Default ( ) TaskScheduler.FromCurrentSynchronizationContext().

+11

Source: https://habr.com/ru/post/1538477/


All Articles