asp.net 2.0 async vs ThreadPool.QueueUserWorkItem

R

robert112

Question... Can one not use ThreadPool.QueueUserWorkItem with an
anonymous method like so:

ThreadPool.QueueUserWorkItem(delegate
{
//perform IO bound operation.
});

Why did the asp.net team create the directive async=true way of
creating async pages???

Will the QueueUserWorkItem method not do the same thing???

Thanks.
 
M

maciek kanski

robert112 said:
Why did the asp.net team create the directive async=true way of
creating async pages???
http://weblogs.asp.net/despos/archive/2005/10/19/427861.aspx

I think there're lot of things to discuss but in my opinion You should
use page-Async pattern in case of web applications performing long IO
operations; the idea is that IIS will break your page life-cycle
(somewhere between PreRender and Render) and in this time-gap the IIS
thread is free to serve another request while your page is performing
boring IO task in another thread; after completion your page again
returns to normal IIs thread to finish its cycle (Render, Unload, ....)
API details
> Will the QueueUserWorkItem method not do the same thing?
Well, I don't have experience with that class in case of web
applications; I propose use the page-Async solution that is designed for
web page while the ThreadPool is rather generic solution.
In special case of fire-and-forget work to be done I would consider
ThreadPool but I didn't look at all the pros and cons.

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top