T
Taras_96
Hi everyone,
The page at http://en.csharp-online.net/CSharp_Delegates_and_Events—Asynchronous_method_calls
states that EndInvoke will block execution on the current thread until
the asynchronous method has finished executing.
Another method described is waiting on a signal:
"The next technique is to block on the IAsyncResult object’s wait
handle. When the asynchronous method is complete, the IAsyncResult
object’s AsyncWaitHandle will be signaled. Then any thread waiting on
that handle will be awakened. Once awake, the thread can call the
IAsyncResult object’s EndInvoke method to receive the return value."
Is there any difference in the two methods? When would you use one or
the other. If anything the second option seems more complicated as it
requires an extra call in order to get the result.
Thanks
Taras
The page at http://en.csharp-online.net/CSharp_Delegates_and_Events—Asynchronous_method_calls
states that EndInvoke will block execution on the current thread until
the asynchronous method has finished executing.
Another method described is waiting on a signal:
"The next technique is to block on the IAsyncResult object’s wait
handle. When the asynchronous method is complete, the IAsyncResult
object’s AsyncWaitHandle will be signaled. Then any thread waiting on
that handle will be awakened. Once awake, the thread can call the
IAsyncResult object’s EndInvoke method to receive the return value."
Is there any difference in the two methods? When would you use one or
the other. If anything the second option seems more complicated as it
requires an extra call in order to get the result.
Thanks
Taras