Ejemplo n.º 1
0
        public async Task AsyncSerialExecutorTests_Small()
        {
            AsyncSerialExecutor executor = new AsyncSerialExecutor();
            List<Task> tasks = new List<Task>();
            random = new SafeRandom();
            operationsInProgress = 0;

            tasks.Add(executor.AddNext(() => Operation(1)));
            tasks.Add(executor.AddNext(() => Operation(2)));
            tasks.Add(executor.AddNext(() => Operation(3)));

            await Task.WhenAll(tasks);
        }
Ejemplo n.º 2
0
 public async Task AsyncSerialExecutorTests_SerialSubmit()
 {
     AsyncSerialExecutor executor = new AsyncSerialExecutor();
     random = new SafeRandom();
     List<Task> tasks = new List<Task>();
     for (int i = 0; i < 10; i++)
     {
         int capture = i;
         logger.Info("Submitting Task {0}.", capture);
         tasks.Add(executor.AddNext(() => Operation(capture)));
     }
     await Task.WhenAll(tasks);
 }