What happens if an asynchronous delegate call never returns?

Posted by RichardHowells on Stack Overflow See other posts from Stack Overflow or by RichardHowells
Published on 2010-06-08T15:38:51Z Indexed on 2010/06/08 15:42 UTC
Read the original article Hit count: 167

Filed under:
|
|
|
|

I found a decent looking example of how to call a delegate asynchronously with a timeout... http://www.eggheadcafe.com/tutorials/aspnet/847c94bf-4b8d-4a66-9ae5-5b61f049019f/basics-make-any-method-c.aspx. In summary it uses WaitOne with a timeout to determine if the call does not return before the timeout expires.

I also know that you should have an EndInvoke to match each BeginInvoke.

So what happens if the wait timeout expires? We (presumably) DON'T want to call EndInvoke as that will block. The code can go on to do 'other things', but have we leaked anything? Is there some poor thread someplace blocked waiting for a return that's never going to happen? Have we leaked some memory where the result-that-will-never-return was going to be placed?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET