private IEnumerable <IThread> CreateThreads(int threadCount) { for (int i = 0; i < threadCount; i++) { IThread thread = _factory.Create(); yield return(thread); } }
/// <summary> /// Initializes a new instance of the <see cref="PinsBehavior" /> class. /// </summary> /// <param name="configurations">The configurations.</param> /// <param name="threadFactory">The thread factory.</param> protected PinsBehavior(IEnumerable <PinConfiguration> configurations, IThreadFactory threadFactory) { this.Configurations = configurations.ToArray(); this.thread = threadFactory.Create(); this.timer = Timer.Create(); this.interval = TimeSpan.FromMilliseconds(250); this.timer.Tick += this.OnTimer; }
public WorkerPoolWorker( int ordinal, IThreadFactory threadFactory, BlockingCollection<IDelivery> deliveries, IDeliveryProcessor connectedProcessor) : base(connectedProcessor) { this.ordinal = ordinal; this.deliveries = deliveries; thread = threadFactory.Create(StartTakingMessages); }
public WorkerPoolWorker( int ordinal, IThreadFactory threadFactory, BlockingCollection <IDelivery> deliveries, IDeliveryProcessor connectedProcessor) : base(connectedProcessor) { this.ordinal = ordinal; this.deliveries = deliveries; thread = threadFactory.Create(StartTakingMessages); }