Exemple #1
0
        private static void MultiThreadedMultiplication()
        {
            Scheduler scheduler = new Scheduler();

            scheduler.Schedule(new UseMultiplicationTask());
            scheduler.Execute();
        }
Exemple #2
0
        private static void MillionsOfTasks()
        {
            Scheduler scheduler = new Scheduler();

            scheduler.Schedule(new GeneratorTask(10));
            scheduler.Execute();
        }
Exemple #3
0
        private static void ScheduledTasks()
        {
            Scheduler scheduler = new Scheduler();
            Future    result    = scheduler.Schedule(new WaitFiveSeconds());

            scheduler.Execute();
        }
Exemple #4
0
 private static void GatherAllFilesTasks()
 {
     Scheduler scheduler = new Scheduler();
     Future files = scheduler.Schedule(new GatherAllFiles(@"D:\OSS"));
     scheduler.Execute();
     Console.WriteLine("Files: {0}, Tasks: {1}", files.GetValue<ICollection<string>>().Count,
         scheduler.TotalTasks);
 }
Exemple #5
0
        private static void GatherAllFilesTasks()
        {
            Scheduler scheduler = new Scheduler();
            Future    files     = scheduler.Schedule(new GatherAllFiles(@"D:\OSS"));

            scheduler.Execute();
            Console.WriteLine("Files: {0}, Tasks: {1}", files.GetValue <ICollection <string> >().Count,
                              scheduler.TotalTasks);
        }
Exemple #6
0
        private static void HandlingErrors()
        {
            Scheduler scheduler = new Scheduler();
            Future result = scheduler.Schedule(new ThrowExceptionWhenZero(5));
            scheduler.Execute();
            try
            {
                result.GetValue<int>();
            }
            catch (TaskFailedException e)
            {
                Console.WriteLine(e);
            }

        }
Exemple #7
0
        private static void HandlingErrors()
        {
            Scheduler scheduler = new Scheduler();
            Future    result    = scheduler.Schedule(new ThrowExceptionWhenZero(5));

            scheduler.Execute();
            try
            {
                result.GetValue <int>();
            }
            catch (TaskFailedException e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #8
0
        private static void ParallelTasks()
        {
            List <int> items = new List <int>();
            Random     r     = new Random();

            for (int i = 0; i < 500000; i++)
            {
                items.Add(r.Next());
            }
            Console.WriteLine("-----------");
            Scheduler     scheduler = new Scheduler();
            ParallelQSort task      = new ParallelQSort(items.ToArray());

            scheduler.Schedule(task);
            scheduler.Execute();

            int[] value = task.Completed.GetValue <int[]>();
        }
Exemple #9
0
        private static void ParallelTasks()
        {
            List<int> items = new List<int>();
            Random r = new Random();
            for (int i = 0; i < 500000; i++)
            {
                items.Add(r.Next());
            }
            Console.WriteLine("-----------");
            Scheduler scheduler = new Scheduler();
            ParallelQSort task = new ParallelQSort(items.ToArray());
            scheduler.Schedule(task);
            scheduler.Execute();

            int[] value = task.Completed.GetValue<int[]>();
        }
Exemple #10
0
 private static void MultiThreadedMultiplication()
 {
     Scheduler scheduler = new Scheduler();
     scheduler.Schedule(new UseMultiplicationTask());
     scheduler.Execute();
 }
Exemple #11
0
 private static void MillionsOfTasks()
 {
     Scheduler scheduler = new Scheduler();
     scheduler.Schedule(new GeneratorTask(10));
     scheduler.Execute();
 }
Exemple #12
0
 private static void ScheduledTasks()
 {
     Scheduler scheduler = new Scheduler();
     Future result = scheduler.Schedule(new WaitFiveSeconds());
     scheduler.Execute();
 }