This project is read-only.

Parallel Operation works in unpredictable way

Dec 26, 2012 at 11:44 AM
Edited Dec 26, 2012 at 11:46 AM

Hello

I need to ask about the way that .And clause works by. In fact when I try to run two operation in parallel way by using And clause the result of workflow come in way that is not predictable, it make the paralyzed operation to be executed twice and make the operations that are come after Then clause to be executed in the order that is not defined in

please try the following code to see my point:

 

var q = Workflow<string>.Definition()
      .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O01"); return ""; })
      .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O02"); return ""; })
      .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O03"); return ""; })

 .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O04"); return ""; })
.And
.Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O05"); return ""; })
.Then()

 .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O06"); return ""; }) .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O07"); return ""; }) .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O08"); return ""; }) .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O09"); return ""; }) .Do(a => { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "-O10"); return ""; }); q.Start();

 

please give me any hint to fix this problem because I heavenly depend on objectflow and change it will make a disaster for me :(

Thank you in advance

Dec 28, 2012 at 12:19 AM

This issue has been raised in a previous post. I'm looking into this and will have an answer in the next week.

Dec 29, 2012 at 2:17 AM
Edited Dec 29, 2012 at 2:22 AM

Thank you so much but in fact I have had repaired it in my copy of the code, and I sent a request to be a contributor with you if that is not a problem, so Please if you accept my request to be a contributor in this project please send to me the information to check in the modification of this problem, thank in advance.

Jan 3, 2013 at 4:22 PM
Edited Jan 3, 2013 at 4:29 PM

Thanks for taking the time to fix this issue.

Could you create a pull request so I can merge this?