public static void StartPool( bool dummy, TimeSpan workArrivedSchedule, TimeSpan producerCheckSchedule, int consumers, CancellationToken cancellationToken) { var factory = new WorkerFactory(); var workerPool = factory.CreatePool(); var workAvailableRepo = new WorkAvailableRepo(1); workerPool.Add( factory.CreateScheduledJob( workArrivedSchedule, token => { workAvailableRepo.Reset(); })); var started = new ManualResetEvent(false); var workFactory = GetWorkFactory(dummy, workerPool, workAvailableRepo); workerPool.Add(factory.CreateProducer( () => new ScheduledProducer( producerCheckSchedule, workFactory.Create, (token) => workFactory.Startup(token, started)))); workerPool.Add(factory.CreateConsumers(consumers)); workerPool.Start(cancellationToken); started.WaitOne(); }