Scheduling services in WF are responsible for arranging workflows onto threads for execution. The two scheduling services provided by WF are the DefaultWorkflowSchedulerService
and the ManualWorkflowSchedulerService
. If we don't explicitly configure a scheduling service, the runtime will use the default scheduler (DefaultWorkflowSchedulerService
). Both classes derive from the WorkflowSchedulerService
class. We can derive our own class from this base class and override its virtual methods if we need custom scheduling logic.
The workflow runtime invokes the Schedule
and Cancel
methods to plan workflow execution. The default scheduling service will schedule workflows to run on threads from the process-wide CLR thread pool. This is why workflows execute asynchronously on a background thread by default, and why our example waits for the workflow to finish by blocking the main thread with an AutoResetEvent
. A host using the manual scheduling service must donate threads to...