Ejemplo n.º 1
0
        private IEnumerable <IThread> CreateThreads(int threadCount)
        {
            for (int i = 0; i < threadCount; i++)
            {
                IThread thread = _factory.Create();

                yield return(thread);
            }
        }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
        public WorkerPoolWorker(
            int ordinal,
            IThreadFactory threadFactory,
            BlockingCollection<IDelivery> deliveries,
            IDeliveryProcessor connectedProcessor)
            : base(connectedProcessor)
        {
            this.ordinal = ordinal;
            this.deliveries = deliveries;

            thread = threadFactory.Create(StartTakingMessages);
        }
Ejemplo n.º 4
0
        public WorkerPoolWorker(
            int ordinal,
            IThreadFactory threadFactory,
            BlockingCollection <IDelivery> deliveries,
            IDeliveryProcessor connectedProcessor)
            : base(connectedProcessor)
        {
            this.ordinal    = ordinal;
            this.deliveries = deliveries;

            thread = threadFactory.Create(StartTakingMessages);
        }