首先,我将任务附加到SmartThreadPool(http://smartthreadpool.codeplex.com/)
SmartThreadPool _threadPool = new SmartThreadPool()
_threadPool.QueueWorkItem(Process, state);
并在 Process 方法中。
private static void Process(object state)
{
// ...
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.BeginGetResponse(new AsyncCallback(OnResponse), request);
return;
}
问题: OnResponse 正在哪个线程中运行?如何使回调也在SmartThreadPool中运行?
static void OnResponse(IAsyncResult ar)
{
}