2022
08-12
08-12
C# ThreadPool之QueueUserWorkItem使用案例详解
先看代码://设置可以同时处于活动状态的线程池的请求数目。boolpool=ThreadPool.SetMaxThreads(8,8);if(pool){ThreadPool.QueueUserWorkItem(o=>this.DoSomethingLong("参数1"));ThreadPool.QueueUserWorkItem(o=>this.DoSomethingLong("参数2"));ThreadPool.QueueUserWorkItem(o=>this.DoSomethingLong("参数3"));ThreadPool.QueueUserWorkItem(o=>this.DoSomethingLong("参数4"));ThreadPoo...
继续阅读 >