473,800 Members | 2,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Exi t 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 1313
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.co m

"Saurabh Sharma" <sa***********@ yahoo.com> wrote in message
news:Or******** ******@TK2MSFTN GP12.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.Exi t 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.GetCurr entProcess().Ki ll();

"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.Exi t 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.microsof t.com> wrote in message
news:xQ******** *****@TK2MSFTNG XA01.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
2995
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 stop button should stop everything that gets started by the start button. There are lots of ways to do this on Linux, but this project has to run under cygwin. So far, the only thing I've gotten to work at all under cygwin is doing an...
10
9892
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 example: os.system("someapplication.exe") and kill it, if it waits longer than let's say 100 seconds
6
4639
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 that I can automate the killing process when blocking and deadlock time is exceeded in certain time elipsade? Can somebody help me on this please? Regards
6
1912
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 like a kludge having to spawn whole new processes build in socket communications and kill via explicit OS calls. I can't see that approach scaling particularly well but I guess there's no choice. Does anyone think it likely that the threading...
3
2405
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 identify a session using V$SESSION and kill it (using ALTER SYSTEM KILL SESSION ‘SID’). By killing a session, kills all the processes ? Or am I getting this all wrong. Kindly explain of forward me to a good link. I tried to Google, but it tells only...
0
9691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10507
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7582
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2948
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.