示例#1
0
        public ThreadPoolHandler StartPool(ThreadPoolOptions threadPoolOptions)
        {
            ThreadPoolHandler threadPoolHandler = this.CreatePool(threadPoolOptions);

            foreach (var job in threadPoolOptions.Jobs)
            {
                threadPoolHandler.addJob(job);
            }

            threadPoolHandler.Start();
            return(threadPoolHandler);
        }
示例#2
0
        public ThreadPoolHandler CreatePool(ThreadPoolOptions threadPoolOptions)
        {
            ThreadPoolHandler handler = new ThreadPoolHandler(threadPoolOptions);
            ThreadPoolHandler result  = null;

            if (!_pool.ContainsKey(handler.PoolName))
            {
                if (_pool.TryAdd(handler.PoolName, handler))
                {
                    result = handler;
                }
            }

            return(result);
        }