Export (0) Print
Expand All

Workflow Threading Sample

Download sample

This sample shows the differences between running a workflow using the Manual Threading model or the default CLR (common language runtime) threading model. It also demonstrates the threading impact of using the DelayActivity activity in a workflow.

This is a console application that is designed to demonstrate the differences between using a single thread in your application for executing the host and the workflow instead of multiple threads for your host and workflow.

The purpose of this application is to show how the execution behavior of a workflow instance changes depending on the threading service that it is using. The threading service that is used to take advantage of the host thread for execution is called ManualWorkflowSchedulerService.

The purpose of the ThreadMonitor class is to color the output of each thread with a different color.

To build the sample

  1. Download the sample by clicking Download Sample.

    This extracts the sample project to your local hard disk.

  2. Click Start, point to Programs, point to Microsoft Windows SDK, and then click CMD Shell.

  3. Go to the source directory of the sample.

  4. At the command prompt, type MSBUILD <Solution file name>.

To run the sample

  1. In the SDK Command Prompt window, run the .exe file in the WorkflowThreading\bin\debug folder (or the WorkflowThreading\bin folder for the Visual Basic version of the sample), which is located below the main folder for the sample.

Remarks

The syntax for this sample is as follows:

WorkflowThreading.exe [Single | Multi] [Delay | WaitForMessage]

Parameter Behavior

Single

Runs the workflow using the same thread as the host application.

Multi

Runs the workflow using a different thread than the host application.

Delay

Incorporates a delay into the workflow execution path. This triggers the execution of a timer.

WaitForMessage

Incorporates an event into the workflow execution path. This forces the workflow to become idle and give execution control back to the host application.

See Also


© 2007 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2015 Microsoft