private void WorkItemCallback(object state) { Interlocked.Decrement(ref this._workItemCount); if (!this._draining && (this._count != 0)) { int num; int num2; ThreadPool.GetAvailableThreads(out num, out num2); if (num >= this._minLocalFreeThreads) { HttpWorkerRequest wr = this.DequeueRequest(num < this._minExternFreeThreads); if (wr != null) { this.ScheduleMoreWorkIfNeeded(); HttpRuntime.ProcessRequestNow(wr); } } } }
// method called to pick up more work private void WorkItemCallback(Object state) { Interlocked.Decrement(ref _workItemCount); // too late for more work if draining if (_draining) { return; } // is queue empty? if (_count == 0) { return; } int workerThreads, ioThreads; ThreadPool.GetAvailableThreads(out workerThreads, out ioThreads); // not enough worker threads to do anything if (workerThreads < _minLocalFreeThreads) { return; } // pick up request from the queue HttpWorkerRequest wr = DequeueRequest(workerThreads < _minExternFreeThreads); if (wr == null) { return; } // let another work item through before processing the request ScheduleMoreWorkIfNeeded(); // call the runtime to process request HttpRuntime.ProcessRequestNow(wr); }