Code
public class Handler
{
IHttpAsyncHandler 成員#region IHttpAsyncHandler 成員
public IAsyncResult BeginProcessRequest(HttpContext context
{
context
AsyncHandler hand = new AsyncHandler(cb
hand
return hand;
}
public void EndProcessRequest(IAsyncResult result)
{
}
#endregion
IHttpHandler 成員#region IHttpHandler 成員
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
throw new NotImplementedException();
}
#endregion
}
public class AsyncHandler : IAsyncResult
{
private bool _completed;
private Object _state;
private AsyncCallback _callback;
private HttpContext _context;
public AsyncHandler(AsyncCallback callback
{
_callback = callback;
_context = context;
_state = state;
_completed = false;
}
IAsyncResult 成員#region IAsyncResult 成員
public object AsyncState
{
get
{
return _state;
}
}
public System
{
get { throw new NotImplementedException(); }
}
public bool CompletedSynchronously
{
get { return false; }
}
public bool IsCompleted
{
get { return _completed; }
}
#endregion
public void StartAsyncWork()
{
ThreadPool
}
private void StartAsyncTask(Object workItemState)
{
Thread
_context
_context
_completed = true;
_callback(this);
}
}
這是Asp
問題
From:http://tw.wingwit.com/Article/program/net/201311/15432.html