R
Ryan Liu
Hi,
I read Microsoft SDK,
ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpovrasynchronousprogramming
overview.htm
there are 4 ways to call EndInvoke:
The code in this topic demonstrates four common ways to use BeginInvoke and
EndInvoke to make asynchronous calls. After calling BeginInvoke you can:
a.. Do some work and then call EndInvoke to block until the call
completes.
b.. Obtain a WaitHandle using IAsyncResult.AsyncWaitHandle, use its
WaitOne method to block execution until the WaitHandle is signaled, and then
call EndInvoke.
c.. Poll the IAsyncResult returned by BeginInvoke to determine when the
asynchronous call has completed, and then call EndInvoke.
d.. Pass a delegate for a callback method to BeginInvoke. The method is
executed on a ThreadPool thread when the asynchronous call completes, and
can call EndInvoke.
What is the difference between the first two way since EndInvoke itself will
block anyway?
BTW, in the second case, will EndInvoke block anymore?
Thanks!
Ryan
I read Microsoft SDK,
ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpovrasynchronousprogramming
overview.htm
there are 4 ways to call EndInvoke:
The code in this topic demonstrates four common ways to use BeginInvoke and
EndInvoke to make asynchronous calls. After calling BeginInvoke you can:
a.. Do some work and then call EndInvoke to block until the call
completes.
b.. Obtain a WaitHandle using IAsyncResult.AsyncWaitHandle, use its
WaitOne method to block execution until the WaitHandle is signaled, and then
call EndInvoke.
c.. Poll the IAsyncResult returned by BeginInvoke to determine when the
asynchronous call has completed, and then call EndInvoke.
d.. Pass a delegate for a callback method to BeginInvoke. The method is
executed on a ThreadPool thread when the asynchronous call completes, and
can call EndInvoke.
What is the difference between the first two way since EndInvoke itself will
block anyway?
BTW, in the second case, will EndInvoke block anymore?
Thanks!
Ryan