Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 85529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:06:13+00:00 2026-05-10T22:06:13+00:00

I was wonder about the proper usage of ManualWorkflowSchedulerService.RunWorkflow(). Do I need to synchronize

  • 0

I was wonder about the proper usage of ManualWorkflowSchedulerService.RunWorkflow(). Do I need to synchronize calls to the same workflowInstanceId across threads when I call ManualWorkflowSchedulerService.RunWorkflow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:06:14+00:00Added an answer on May 10, 2026 at 10:06 pm

    No, I don’t think so. Following is a relevant excerpt from the book ‘Essential Windows Workflow Foundation’

    Although operations on WorkflowInstance can be invoked on arbitrary threads, the WF scheduler hosted within the program instance is serviced by a single thread. The WF runtime guarantees that no other thread can interfere or service the scheduler while its dispatcher loop is actively processing work items. To be clear, the hosting application can invoke methods of WorkflowInstance on separate threads concurrently – this does not affect the scheduler executing the activities on a dedicated thread (for an episode of execution).


    EDIT: In order to further investigate the issue, I created a wf with a ParallelActivity which contains two HandleExternalEvent activities. The invoked handler of each activity simply puts its thread to sleep for 3 seconds. In the host program, I created two threads and trigger the two events via the service. Moreover, I subclass the ManualWorkflowSchedulerService in order to track its Schedule method. Here are the results (the time is in 10ths of ms):

    Src    Time Thread HOST   7616      1 CreateWorkflow MWSS   7642      1 Schedule workflow HOST   8297     12 Trigger event 1 and wait for RunWorkflow MWSS   8316     12 Schedule workflow   WF   8327     12 Handler 1 Invoked...wait 3 sec HOST   8327      1 Press any key to exit... HOST   8767     13 Trigger event 2 and wait for RunWorkflow MWSS   8784     13 Schedule workflow   WF  38319     12 Handler 1 Completed   WF  38406     12 Handler 2 Invoked...wait 3 sec   WF  68396     12 Handler 2 Completed HOST  68573     13 RunWorkflow for event 2 completed in 5,98 sec HOST  68794     12 WorkflowCompleted HOST  68795     12 RunWorkflow for event 1 completed in 6,05 sec 

    Some remarks:

    1. The scheduler always use the thread of the host to schedule the workitem.
    2. The workflow instance does not always use the thread of the host to execute the activities. If another activity is already executing in a thread, then this thread is used for executing all scheduled activities.
    3. The execution of the handlers is thread-safe, but both threads wait both handlers to finish!

    If the latter is your concern, I would suggest the following posts:

    • Understanding ParallelActivity in Windows Workflow
    • Use Workflow to Invoke Web Services in Parallel

    BTW, can you share some info about the scenario that you are facing?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 74k
  • Answers 74k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer We also use vmware for our servers, one vmware host… May 11, 2026 at 2:12 pm
  • added an answer Along with a key you need an Initialization Vector (8… May 11, 2026 at 2:12 pm
  • added an answer You can't have forward declarations for record types. Define both… May 11, 2026 at 2:12 pm

Related Questions

I was wonder if there is a simpler (single) way to calculate the remaining
i wonder if i've found a compiler bug? i was removing some old code
I was trying to get my head around XAML and thought that I would
I was reading this question about how to parse URLs out of web pages
I have a server application (singleton, simple .NET console application) that talks to a
I was recently reading about the Arduino's Hello World application, and I thought to
[Meta-note:] I was browsing the question page, getting really tired of DIVS vs Tables
Hiya - still @ the design stages of an app, and was wondering about

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.