Exemple #1
0
 private static void CallDependencies(Computation c, bool executeBefore)
 {
     TaskParallel.ForEach(c.TransformationRule.Dependencies, requirement =>
     {
         if (requirement.ExecuteBefore == executeBefore)
         {
             requirement.HandleDependency(c);
         }
     });
 }
Exemple #2
0
        public static void Handle(List <A> aArray)
        {
            int    incorrectCount = 0;
            object o = new object();

            Par.ForEach(aArray, async a =>
            {
                if (a.Incorrect)
                {
                    lock (o)
                    {
                        incorrectCount++;
                    }
                }
                else
                {
                    Thread.Sleep(a.I * 1000);
                    Console.WriteLine(a.I);
                }
            });
            Console.WriteLine($"Total incorrect {incorrectCount}");
        }