Parallel Operations

Dec 11, 2012 at 11:49 AM

Hi,

I'm sorry, most probably I can't understand documentation correctly but how should work parallel tasks mechanism?

Even whit a simple loop delay the Second last StatusOperation ends as last task.

Status.statusvalue has always "Passed" value.

My intent is to start two parallel StatusOperation task and get LastOperation task waiting for both termination. 

Thanks in advance

 

namespace WflowTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Status state = new Status();
            IWorkflow<Status> a = Workflow<Status>.Definition().Do<StatusOperation>().And.Do<StatusOperation>().Then().Do(new LastOperation());
            a.Start(state);
            System.Console.WriteLine(state.statusvalue);
        }


        public class Status
        {
            public string statusvalue;

        }

        public class StatusOperation : BasicOperation<Status>
        {
            public override Status Execute(Status data)
            {
                for (long i = 0; i < 10000000; i++)
                {
                    // dummy
                }
                data.statusvalue = "Passed";
                return data;
            }
        }

        public class LastOperation: BasicOperation<Status>
        {
            public override Status Execute(Status data)
            {
               
                data.statusvalue = "Last Operation";
                return data;
            }
        }
    }

Coordinator
Dec 28, 2012 at 12:22 AM

I've investigated and there seems to be an issue.  I'll have a resolution in the next week.

 

Thanks for highlighting this issue. 

Coordinator
Jan 21, 2013 at 11:27 AM

Thanks to a contribution from morikapt this has been fixed in the latest nuget package.