473,406 Members | 2,847 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,406 software developers and data experts.

Killing the processes.

Hi
I have made a Windows Form and in it few calculations and processos are
running. When i close the form the process continues to run until that
particular function in finished. I cant use Environment.Exit 0 as they and
in the subform and i want to load the main form when i close that.
Please tell me how to stop all the functions once a loop is closed

Regards
Saurabh Sharma
Nov 16 '05 #1
5 1300
Saurabh,

When your app closes, you should send a signal to the thread to indicate
that it should stop its work, and close down gracefully (whether through a
variable that is constantly checked, or some other mechanism).

Only then, should your app shut down. Forcefully killing the thread is
a bad idea.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Saurabh Sharma" <sa***********@yahoo.com> wrote in message
news:Or**************@TK2MSFTNGP12.phx.gbl...
Hi
I have made a Windows Form and in it few calculations and processos are
running. When i close the form the process continues to run until that
particular function in finished. I cant use Environment.Exit 0 as they and
in the subform and i want to load the main form when i close that.
Please tell me how to stop all the functions once a loop is closed

Regards
Saurabh Sharma

Nov 16 '05 #2
clu
Saurabh,

if you don't care about gracefully completing the worker thread
operations before quitting your application, you might consider about
setting the IsBackground property of your worker thread to true.
Otherwise, the application keeps running until the secondary thread
completes.

However, it is surely better to quit gracefully and provide cleanup
code, as Nicholas pointed out.

HTH

Claudio Brotto

Nov 16 '05 #3
Process.GetCurrentProcess().Kill();

"Saurabh Sharma" wrote:
Hi
I have made a Windows Form and in it few calculations and processos are
running. When i close the form the process continues to run until that
particular function in finished. I cant use Environment.Exit 0 as they and
in the subform and i want to load the main form when i close that.
Please tell me how to stop all the functions once a loop is closed

Regards
Saurabh Sharma

Nov 16 '05 #4
Hi Saurabh
what you need to do is to notify the thread that you application is done
and no need for it to be running ( the way you choose to implement that is
variant and dependes on the logic of your application) . Then the thread
now( when it get such notification) can do its own exit.
Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #5
Hi all
Yeah i am currently doing that returning a bool when the form is closing.
And that form has many funtions in it. So i am checking it in every
function. Just wanted to know is there anything which automatically tells
that form is closed.
Thanx for the suggestions they were of great help

Saurabh

"Mohamoss" <mo************@egdsc.microsoft.com> wrote in message
news:xQ*************@TK2MSFTNGXA01.phx.gbl...
Hi Saurabh
what you need to do is to notify the thread that you application is done
and no need for it to be running ( the way you choose to implement that is
variant and dependes on the logic of your application) . Then the thread
now( when it get such notification) can do its own exit.
Mohamed M .Mahfouz
Developer Support Engineer
ITWorx on behalf of Microsoft EMEA GTSC

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Laura Conrad | last post by:
I'm writing an application that has to spawn some processes and then kill them later. It doesn't need to talk or listen to them while they're running, but there are stop and start buttons and the...
10
by: Jacek Popławski | last post by:
Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for...
6
by: laststubborn | last post by:
Hi everybody, We have a very large database and high transaction volume. Time to time these transactions are locking each other and decrease the performance of the database. Is there any way...
6
by: Roger Heathcote | last post by:
sjdevnull@yahoo.com wrote: <snip> Fair point, but for sub processes that need to be in close contact with the original app, or very small functions that you'd like 100s or 1000s of it seems...
3
by: eeriehunk | last post by:
Hi All, I am a little confused between a session and a process. I learnt that an Oracle Session is created for every login. And we can run many processes in one session. I have also learnt how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.