Most of the time, it's a case of personal preference.  I find the
type-awareness of async delegates to be most useful, as I rarely have a
need to call methods that match the WaitCallback delegate mandated by
QUWI.  I think the biggest reason QUWI is supported is because it's
supported in the Win2k Win32 function by the same name.

That said, one difference that's recently come to light is that the .NET
1.1 sdk docs have introduced a new caution stating that EndInvoke must
be called after using BeginInvoke in order to avoid leaking things [1].
So we can't use BeginInvoke in a fire-and-forget model as easily as
we're used to (see [1] for a work around).  But QUWI still provides that
kind of model, where you don't need to know when execution of the target
method happens, or care what it returns.  But you're restricted to the
one signature defined by WaitCallback...

-Mike
DevelopMentor
http://staff.develop.com/woodring

[1]
http://discuss.develop.com/archives/wa.exe?A2=ind0302B&L=ADVANCED-DOTNET
&P=R1085&I=-3


> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED]] On Behalf Of Heath Ryan
> Sent: Thursday, February 13, 2003 4:28 AM
> To: [EMAIL PROTECTED]
> Subject: [ADVANCED-DOTNET] delegate vs threadpool
>
>
> Hi,
>
> can some elaborate on
> when to use a delegate's BeginInvoke or ThreadPool.QueueUserWorkItem?
>
> Since they both semantically do the same, see following code.
>

Reply via email to