public static async Task TestMethod() { // Here we separate all the Tasks in distinct threads CancellationTokenSource cancelSource = new CancellationTokenSource(); Task c = Task.Run(async() => { Console.WriteLine("Press any key to cancel from thread " + Thread.CurrentThread.ManagedThreadId.ToString()); Console.ReadKey(); // if a key is pressed, we cancel cancelSource.Cancel(); }); Task sqs = Task.Run(async() => { Console.WriteLine("Amazon on thread " + Thread.CurrentThread.ManagedThreadId.ToString()); while (true) { ProducerConsumer.BackgroundFakedAmazon(); // We produce 50 Strings each second await Task.Delay(1000); } }); Task deq = Task.Run(async() => { Console.WriteLine("Dequeue on thread " + Thread.CurrentThread.ManagedThreadId.ToString()); while (true) { ProducerConsumer.DequeueData(); // Dequeue 20 Strings each 100ms await Task.Delay(100); } }); Task process = Task.Run(() => { Console.WriteLine("Process on thread " + Thread.CurrentThread.ManagedThreadId.ToString()); ProducerConsumer.BackgroundParallelConsumer(); // Process all the Strings in the BlockingCollection }); await Task.WhenAll(c, sqs, deq, process); }