Having read the phrase "The current SynchronizationContext is a property of the current thread" correct", I am a little confused...
In a C# app code in VS2010, when I type Thread.CurrentThread.
I am not finding in the drop-down list of choices given by Intellisense any context-related properties for a thread.
I know that current synchronization context can be got through "= SynchronizationContext.Current;
" . But this is not quite fortunate with simultaneously executed in parallel threads, tasks, etc.
Suppose from a console or WPF (*) app I create and launch a few Windows forms in its own main UI threads as well as TPL tasks.
I undermisabovestand that each winform should have its own WindowsFormaSynchronizationContext, WPF should have its own DispatcherSynchronizationContext (subclasses of SynchronizationContext class) instances, the tasks are executed in a ThreadPool with its own synchronization context, LongRunning task orobably will be executed out of thread pool in its own synchronization context...
So, why cannot the SynchronizationContext
be defined from thread(s)? All answers to "Get SynchronizationContext from a given Thread" question seem to unanmous in negating tis possibility...
And the last, but not least:
Is the phrase "The current SynchronizationContext is a property of the current thread" correct" correct?
Then, how can I get the value of this property for different particular thread instances?
(*)
Recently, I was given C# WPF app code essentially using winforms.