• λ我爱Aspx >> Asp.Net >> Custom Thread Pooling Template
  • Custom Thread Pooling Template

  • :aspxer  Դ:internet  :2007-5-31 2:19:47  ؼ:
  • Custom Thread Pooling Template

    om Thread Pooling Template

    Now that we have covered the basics of Visual Studio .NET project types and templates, let us look at how we can write our own custom project template that will generate a thread pool that can be used by the developer without any modifications at all. Before we start discussing the custom template, let us focus on writing a thread pool class that will be a part of this template.

    A thread pool usually consists of two classes: one class that represents a thread, and another class that represents the object that manages a pool of these thread objects. The thread class is fairly simple: it is simply an encapsulation of the built in System.Threading.Thread class, but the thread pool class is slightly more involved. This thread pool class has to create all the threads in the pool, assign them work, and keep track of idle threads so that further work can be assigned to them. Further, the threads in a thread pool are created once, and if a thread is idle, the thread goes into an efficient wait mode (like a sleep call). When there is work to be processed, the thread pool is responsible for bringing an idle thread back into active mode and assigning it work.

    Ҷƪл˵?
  • һƪ把昨天写的东西的代码公布出来。哎。。真恶心。
    һƪ在.Net中监控Processes和Threads(1)