PC Review


Reply
Thread Tools Rate Thread

asp.net 2.0 async vs ThreadPool.QueueUserWorkItem

 
 
robert112
Guest
Posts: n/a
 
      5th Jan 2008
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.
 
Reply With Quote
 
 
 
 
maciek kanski
Guest
Posts: n/a
 
      5th Jan 2008
robert112 wrote:
> Why did the asp.net team create the directive async=true way of
> creating async pages???

http://weblogs.asp.net/despos/archiv...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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ThreadPool.QueueUserWorkItem =?Utf-8?B?SlQ=?= Microsoft Dot NET Framework 3 24th Oct 2007 07:28 PM
ThreadPool.QueueUserWorkItem James Microsoft VB .NET 2 16th Feb 2006 10:38 AM
About ThreadPool.QueueUserWorkItem and ThreadPool.RegisterWaitForSingleObject Henri Microsoft ASP .NET 5 8th Dec 2005 09:55 AM
BeginRead & ThreadPool.QueueUserWorkItem Lloyd Dupont Microsoft Dot NET Framework 4 16th Sep 2005 02:58 PM
ThreadPool.QueueUserWorkItem pmclinn Microsoft VB .NET 1 20th Jun 2005 03:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:21 AM.