Which TaskScheduler will be used for my Task?

Ákos DUDÁS

Task Parallel Library Tasks work with schedulers. The most frequently used one is the default, the ThreadPool scheduler. But one can create custom schedulers too. In this case, you need to know, how the runtime chooses the scheduler for a particular task.

  • If you specify a scheduler, it will use that.
  • If you do not specify a scheduler, it will use the current one (TaskScheduler.Current). The current one depends on the context.
    • A new task started in the program will use the default scheduler (TaskScheduler.Default), which is the ThreadPool scheduler.
    • But tasks started from within tasksinherit the scheduler of their parent task.
  • Continuations do not inherit the scheduler of their antecedent.

View original post

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: