473,320 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 12261
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 running, if so set the flag to exit the thread. ...
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 the main request/response threads aren't...
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 code. Thread A handles call activity on telephone...
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 notification, I want to refresh the form. I am...
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 loop till it is asked to exit by setting an event....
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 case. I have 20 socket clients. Each client send a...
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 scenario: 1) App.Exe is launched. 2) App.Exe calls...
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 dont need a windows form to check if there is an...
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 creates the thread B. The thread B has access...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.