472,328 Members | 1,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

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 12176
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Maloney | last post by:
Exit thread in C#CF. I'm createing a thread and setting a class object for when to exit. Before creating the thread i check if the thread is...
11
by: PJ | last post by:
I'd like to create a subsystem in my asp.net application that is responsible for emails that need to be send out based upon certain events so that...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical...
3
by: cnu | last post by:
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...
2
by: Tim | last post by:
The are 2 threads - main thread and worker thread. The main thread creates the worker thread and then the worker thread runs in an infinite while...
5
by: zxo102 | last post by:
Hi, I am doing a small project using socket server and thread in python. This is first time for me to use socket and thread things. Here is my...
3
by: Bill Davidson | last post by:
All: I have a problem in which a worker thread in my (.dll) assembly isn't allowing the main (.exe) assembly from terminating. Here's the...
2
by: giddy | last post by:
hi , I'm in a slight dilemma. I have an updater program that checks for pending updates and downloads them if the users chooses to. Since i...
18
by: J.K. Baltzersen | last post by:
To whomever it may concern: I am using MS Visual C++ 6.0. I have a process A which instantiates an object C. At a later point the process A...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.