示例#1
0
        static void Main(string[] args)
        {
            var tp = new MyThreadPool(CancellationToken.None);
            var l  = new ThreadPoolListener(tp);

            for (var i = 0; i < 100; i++)
            {
                tp.AddAction(() => { i++; }, CancellationToken.None);
            }
            Console.WriteLine("Hello World!");
            Console.ReadLine();
        }
示例#2
0
 public ThreadPoolListener(MyThreadPool threadPool)
 {
     _threadPool = threadPool;
     _threadPool.OnFinishedActionEvent += ShowFinishedInfo;
 }