Let's say I have an event handler that spawns another thread
In that original event handler, is there a way to check, and do something
ONLY after the thread is complete?

Re: Threading question by Jon

Jon
Fri Sep 21 13:34:05 PDT 2007

Trust Me; I'm from the government <sm@here.com> wrote:
> Let's say I have an event handler that spawns another thread
> In that original event handler, is there a way to check, and do something
> ONLY after the thread is complete?

Give the thread a callback delegate to execute when it's finished. If
you want that marshalled to a particular thread, you'll need to use
something akin to Control.Invoke.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too

Re: Threading question by Trust

Trust
Fri Sep 21 13:53:10 PDT 2007

I'm brand new to threads -
could you get me to a very simple tutorial or code sample that shows how to
do this and explains it very simply?



"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.215e3b15554e6df4a2@msnews.microsoft.com...
> Trust Me; I'm from the government <sm@here.com> wrote:
>> Let's say I have an event handler that spawns another thread
>> In that original event handler, is there a way to check, and do something
>> ONLY after the thread is complete?
>
> Give the thread a callback delegate to execute when it's finished. If
> you want that marshalled to a particular thread, you'll need to use
> something akin to Control.Invoke.
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too



Re: Threading question by Jon

Jon
Fri Sep 21 14:56:33 PDT 2007

Trust Me; I'm from the government <sm@here.com> wrote:
> I'm brand new to threads -
> could you get me to a very simple tutorial or code sample that shows how to
> do this and explains it very simply?

I suggest you learn about threads in general from the start, then apply
it to your particular situation.

See http://pobox.com/~skeet/csharp/threads

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too