Questions tagged [terminate]

For questions regarding the termination of processes, threads, and sessions.

937 questions
977
votes
31 answers

Is there any way to kill a Thread?

Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?
Sudden Def
  • 10,031
  • 3
  • 18
  • 8
217
votes
35 answers

How to stop C++ console application from exiting immediately?

Lately, I've been trying to learn C++ from this website. Unfortunately whenever I try to run one of the code samples, I see that program open for about a half second and then immediately close. Is there a way to stop the program from closing…
Adam P
  • 4,603
  • 6
  • 31
  • 40
171
votes
19 answers

How to stop/terminate a python script from running?

I wrote a program in IDLE to tokenize text files and it starts to tokeniza 349 text files! How can I stop it? How can I stop a running Python program?
MACEE
  • 1,923
  • 4
  • 15
  • 10
127
votes
4 answers

SBT stop run without exiting

How do you terminate a run in SBT without exiting? I'm trying CTRL+C but it exits SBT. Is there a way to only exit the running application while keeping SBT open?
dsg
  • 12,924
  • 21
  • 67
  • 111
100
votes
5 answers

Self-Terminating AWS EC2 Instance?

Is there a way that Amazon Web Services EC2 instances can be self terminating? Does Amazon have anything that allows an instance to terminate itself ("Hara-Kiri") after running for more than say an hour? I could change the scripts on the running…
Steve3p0
  • 2,332
  • 5
  • 22
  • 30
79
votes
15 answers

How to terminate a Xamarin application?

How to terminate a Xamarin application from any of the activities? I have tried both System.Environment.Exit(0) and System.Environment.Exit(1) as well as Finish() and killing all the activities. It still opens one blank page with default activity…
Nik
  • 791
  • 1
  • 5
  • 4
62
votes
4 answers

PHP - exit or return which is better?

I would like to know in the following case which is a better option: In the PHP script, if the $fileSize variable is larger than 100, I stop the script; Case I: 100 ) { $results['msg'] = 'fileSize is too big!'; echo…
q0987
  • 34,938
  • 69
  • 242
  • 387
51
votes
4 answers

Why not to start a thread in the constructor? How to terminate?

I am learning how to use threads in Java. And I wrote a class that implements Runnable to run concurrently to another thread. The main thread handles listening to the serial port where as the second thread will handle sending data to that same…
Zac
  • 2,229
  • 9
  • 33
  • 41
47
votes
5 answers

How to perform an async operation on exit

I've been trying to perform an asynchronous operation before my process is terminated. Saying 'terminated' I mean every possibility of termination: ctrl+c Uncaught exception Crashes End of code Anything.. To my knowledge the exit event does that…
Kesem David
  • 2,135
  • 3
  • 27
  • 46
46
votes
17 answers

Android emulator won't shut down

The emulator starts up fine. But when you long-press the power button (or F7) and choose "Power off", it displays a "Shutting down" message which remains on-screen forever and the emulator won't actually shut down. I can close the emulator window or…
Cyker
  • 9,946
  • 8
  • 65
  • 93
43
votes
11 answers

Stopping Excel Macro executution when pressing Esc won't work

I'm running excel 2007 on XP. Is there a way to stop a macro from running during its execution other than pressing escape? Usually if I think I created an infinate loop or otherwise messed something up I hit escape and it throws an error but the…
ptpaterson
  • 9,131
  • 4
  • 26
  • 40
35
votes
11 answers

Process.HasExited returns true even though process is running?

I have been observing that Process.HasExited sometimes returns true even though the process is still running. My code below starts a process with name "testprogram.exe" and then waits for it to exit. The problem is that sometimes I get thrown the…
johnrl
  • 873
  • 3
  • 14
  • 18
33
votes
3 answers

Amazon EC2 autoscaling down with graceful shutdown?

We're looking at using EC2 autoscaling to deal with spikes in load. In our case we want to scale up instances based on an SQS queue size and then down scale with the queue size gets back under control. Each SQS message defines a potentially long…
danw
  • 1,528
  • 1
  • 17
  • 17
29
votes
6 answers

Do IDisposable objects get disposed of if the program is shut down unexpectedly?

What happens if the program exits unexpectedly (either by exception or the process is terminated)? Are there any situations like this (or otherwise) where the program will terminate, but IDisposable objects won't be properly disposed of? The reason…
JSideris
  • 5,101
  • 3
  • 32
  • 50
27
votes
6 answers

Which is the proper way to terminate a delphi application?

I would like to terminate a Delphi application without executing any other code line and I'm wondering about which is the proper way to do this. Furthermore, I would like to know if there's something wrong in what I'm actually doing at the…
Hwau
  • 850
  • 3
  • 12
  • 23
1
2 3
62 63