Parallel Operation works in unpredictable way

Developer
Dec 26, 2012 at 10:44 AM
Edited Dec 26, 2012 at 10: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

Coordinator
Dec 27, 2012 at 11:19 PM

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

Developer
Dec 29, 2012 at 1:17 AM
Edited Dec 29, 2012 at 1: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.

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

Thanks for taking the time to fix this issue.

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