Task.Run vs RunSynchronously

Task.Run = Tasks are executed asynchronously on a thread pool thread and do not block the calling thread.

​Task.RunSynchronously: Run on the calling thread, Blocks caller.

Both cases need to Wait() to catch exceptions..

TaskScheduler:

Latter: Task gets associated with the current TaskScheduler.

If the target scheduler does not support running this task on the calling thread, the task will be scheduled for execution on the scheduler (? which one), and the calling thread will block until the task has completed execution.
Leave a Reply

Your email address will not be published. Required fields are marked *