首先,我将一个任务附加到 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)
{
}