469,360 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,360 developers. It's quick & easy.

How to get Thread exit notification

cnu
Hi,
I am starting a new threading to do some process. I want to get notified
when the thread does it's job and exits. After receiving the notification, I
want to refresh the form.

I am starting the thread like this:
<code>
System.Threading.ThreadStart tDelegate = new
System.Threading.ThreadStart(this.InitBasicService sInfo);
this.m_threadProgress = new System.Threading.Thread(tDelegate);
this.m_threadProgress.IsBackground = true;
this.m_threadProgress.Name = "<InitBasicServicesInfo>";
this.m_threadProgress.Start();

</code>

Is there any event/notification message for this requirement.

Thanks

Jul 21 '05 #1
3 11958
cnu <cn*@discussions.microsoft.com> wrote:
I am starting a new threading to do some process. I want to get notified
when the thread does it's job and exits. After receiving the notification, I
want to refresh the form.

I am starting the thread like this:
<code>
System.Threading.ThreadStart tDelegate = new
System.Threading.ThreadStart(this.InitBasicService sInfo);
this.m_threadProgress = new System.Threading.Thread(tDelegate);
this.m_threadProgress.IsBackground = true;
this.m_threadProgress.Name = "<InitBasicServicesInfo>";
this.m_threadProgress.Start();

</code>

Is there any event/notification message for this requirement.


The easiest thing would be to make the new thread call back to the form
to say it had finished "on its way out". If you want to do this in a
few places, you could create your own wrapper which takes a
ThreadStart, and when it's asked to run, it runs the delegate and then
calls back.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Jon,
Is there an example of what you are describing or more detailed description
of handling threads somewhere?

Doug
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
cnu <cn*@discussions.microsoft.com> wrote:
I am starting a new threading to do some process. I want to get notified when the thread does it's job and exits. After receiving the notification, I want to refresh the form.

I am starting the thread like this:
<code>
System.Threading.ThreadStart tDelegate = new
System.Threading.ThreadStart(this.InitBasicService sInfo);
this.m_threadProgress = new System.Threading.Thread(tDelegate);
this.m_threadProgress.IsBackground = true;
this.m_threadProgress.Name = "<InitBasicServicesInfo>";
this.m_threadProgress.Start();

</code>

Is there any event/notification message for this requirement.


The easiest thing would be to make the new thread call back to the form
to say it had finished "on its way out". If you want to do this in a
few places, you could create your own wrapper which takes a
ThreadStart, and when it's asked to run, it runs the delegate and then
calls back.

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

Jul 21 '05 #3
Doug Bell <ma**@vodaphone.com.au> wrote:
Is there an example of what you are describing or more detailed description
of handling threads somewhere?


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

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Maloney | last post: by
11 posts views Thread by PJ | last post: by
3 posts views Thread by Bill Davidson | last post: by
18 posts views Thread by J.K. Baltzersen | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.