Пример #1
0
        public ThreadCollection(SimpleThreadPoolSettings settings)
        {
            settings.Check();

            this.settings = settings;

            modificationSemaphore = new SemaphoreSlim(1, 1);

            workingThreads = new ConcurrentStack <WorkingThread>();
        }
Пример #2
0
        internal SimpleThreadPool(SimpleThreadPoolSettings settings, ThreadCollection threadCollection)
        {
            if (threadCollection == null)
            {
                throw new ArgumentException("threadCollection");
            }

            settings.Check();

            this.settings = settings;

            if (this.settings.MaxWorkingQueueCapacity == null)
            {
                blockingCollection = new BlockingCollection <IThreadPoolWorkItem>();
            }
            else
            {
                blockingCollection = new BlockingCollection <IThreadPoolWorkItem>(this.settings.MaxWorkingQueueCapacity.Value);
            }

            this.threadCollection = threadCollection;

            TryAddThreads(settings.StartWorkingThreadsCount);
        }
Пример #3
0
 public SimpleThreadPoolCreator(SimpleThreadPoolSettings settings, PerformanceBalanceSettings performanceBalanceSettings)
 {
     Settings = settings;
     PerformanceBalanceSettings = performanceBalanceSettings;
 }