What is the difference between SynchronizationContext.Send and SynchronizationContext.Post?

Send – synchronous: wait for answer (or action completed) Post – asynchronous: drop off and continue So your example uses the correct methods at the right moments. There is no need to halt the for-loop until the progress update is complete (on the contrary). And Execute does want to wait for the Action to complete, … Read more

What is the conceptual difference between SynchronizationContext and TaskScheduler

I was just reading CLR via C# book by Jeffrey Ritcher and thanks to him I can also give some easy explanation related to that topic. (assuming that I am not fully agreed with the whole details in answers) First of all, TaskScheduler object is responsible for executing scheduled tasks. The FCL ships with two … Read more

Why is TaskScheduler.Current the default TaskScheduler?

I think the current behavior makes sense. If I create my own task scheduler, and start some task that starts other tasks, I probably want all the tasks to use the scheduler I created. I agree that it’s odd that sometimes starting a task from the UI thread uses the default scheduler and sometimes not. … Read more

Post-increment and Pre-increment concept?

All four answers so far are incorrect, in that they assert a specific order of events. Believing that “urban legend” has led many a novice (and professional) astray, to wit, the endless stream of questions about Undefined Behavior in expressions. So. For the built-in C++ prefix operator, ++x increments x and produces (as the expression’s … Read more

What’s the difference between Task.Start/Wait and Async/Await?

I may be missing something You are. what is the difference between doing Task.Wait and await task? You order your lunch from the waiter at the restaurant. A moment after giving your order, a friend walks in and sits down next to you and starts a conversation. Now you have two choices. You can ignore … Read more

tech