/// <summary>
        /// Creates a new ThreadPool of numThreads size. These Threads are waiting
        /// for jobs to be added via the addJob method.
        /// </summary>
        /// <param name="name">the name to use for the thread group and worker threads.</param>
        /// <param name="numThreads">the number of threads to create.</param>
        public ThreadPool(string name, int numThreads)
        {
            this.name       = name;
            this.numThreads = numThreads;
            jobs            = new List <AGIConnectionHandler>();
            running         = true;

            // create and start the threads
            for (int i = 0; i < this.numThreads; i++)
            {
                ThreadTask thread;
                thread = new ThreadTask(this, this.name + "-TaskThread-" + i);
                thread.Start();
            }
#if LOGGER
            logger.Debug("ThreadPool created with " + this.numThreads + " threads.");
#endif
        }
Exemple #2
0
        /// <summary>
        /// Creates a new ThreadPool of numThreads size. These Threads are waiting
        /// for jobs to be added via the addJob method.
        /// </summary>
        /// <param name="name">the name to use for the thread group and worker threads.</param>
        /// <param name="numThreads">the number of threads to create.</param>
        public ThreadPool(string name, int numThreads)
        {
            this.name = name;
            this.numThreads = numThreads;
            jobs = new List<AGIConnectionHandler>();
            running = true;

            // create and start the threads
            for (int i = 0; i < this.numThreads; i++)
            {
                ThreadTask thread;
                thread = new ThreadTask(this, this.name + "-TaskThread-" + i);
                thread.Start();
            }
            #if LOGGER
            logger.Debug("ThreadPool created with " + this.numThreads + " threads.");
            #endif
        }