I have a different scenario than this question , so another question.
Take the following example:
void PerformanceCriticalMethod()
{
Dispatcher.Invoke(() => Log.Add("1"));
... some job
Dispatcher.Invoke(() => Log.Add("2"));
}
Invokecreates performance issues. In an attempt to fix this, I used InvokeAsyncinstead Invokeand it seems to work, but it is important what 2will be output after 1 .
Can I rely on the assumption that if two InvokeAsyncare called from the same thread, they will execute in the same order? My winapi nut tells me this, but I want to be sure.
And another related question is the same as the related one: if the same method is called through an InvokeAsyncaction from different threads, how good are the chances of executing it first for the thread that it calls InvokeAsyncbefore?
P.S.: , " InvokeAsync", "", , 100% , ( ) .