Re: Delegate.BeginInvoke and EndInvoke.

Peter Ritchie <[email protected]> Tue, 15 Jan 2008 15:07:24 -0500
Newsgroups gmane.comp.windows.devel.dotnet.winforms
Message-ID <LISTSERV%[email protected]>
On Tue, 15 Jan 2008 12:50:15 -0700, Bhatnagar, Amit
<[email protected]> wrote:

>Well then I don't see how this approach helps me out then. My motivation
>for doing this was to not get tied up when my call to
>SystemParametersInfo doesn't return as per my previous thread.

If you're looking for an ability for one thread to not be blocked by
another, this will suit your needs.  If you're looking to terminate a
thread when a blocked call is taking too long, this will not do what you
want.

Asynchronous delegates use threadpool threads, there's no reliable way to
terminate a threadpool thread.

>
>(No WM_SETTINGCHANGE message received by my windows as verified by
>spy++)

That sounds serious, I would suggest contacting PSS about that.  Can you
provide code that reproduces the problem?

>
>If this delegate never returns in this case, then won't I have one
>thread in the pool that will just hang?

Yes.

>Is there no way to terminate
>this delegate after the time out period?

No, see above.