I am a huge fan of ms!
I wrote thread pool before, and unfortunely, it failed. At that time i was not willing to dig more and found out the truth until i read this article. http://www.cnblogs.com/artech/archive/2009/05/22/1486761.html%20Is that true?
It is important. Of threadpool, what i expected is as below:
1. The thread should be executed randomly, not from 1 to 10. It is true, it is true.
2. The application will not exit until all the threads are done. It is not true, it is not true...
And lucky enough, I read a comment from http://msdn.microsoft.com/en-us/library/4yd16hza.aspx, it mentioned that:
// If you comment out the Sleep, the main thread exits before the ThreadPool task has a chance to run. ThreadPool uses background threads, which do not keep the application running.
转载于:https://www.cnblogs.com/pangpangxiong/archive/2009/07/01/1511658.html