termination

Terminating a Python script

I am aware of the die() command in PHP which stops a script early, how can I do this in Python? ...

What happens in WCF to methods with IsOneWay=true at application termination

Hi, I have a client application that once in while notifies about its progress a service. The method call to the service is marked with IsOneWay=true, because the notification doesn't need any return value and I don't want to delay. The client may notify about errors to the service, and afterward it terminates. The question is: does ...

Guaranteed file deletion upon program termination (C/C++)

Win32's CreateFile has FILE_FLAG_DELETE_ON_CLOSE, but I'm on Linux. I want to open a temporary file which will always be deleted upon program termination. I could understand that in the case of a program crash it may not be practical to guarantee this, but in any other case I'd like it to work. I know about RAII. I know about signals...

Does the termination condition of a 'for loop' refresh in VC++ 6?

for (int i = 0 ; i < stlVector.size() ; i++) { if (i == 10) { stlVector.erase(stlVector.begin() + 5 ) } } Does the termination condition part "stlVector.size()" take "stlVector.erase(...)" into consideration? In other word does stlVector.size() refresh for every loop iteration? I can't test it right now, so i post...

Proper way to clean up a permanent thread in C#

I have an object, a Timeline, that encapsulates a thread. Events can be scheduled on the timeline; the thread will wait until it is time to execute any event, execute it, and go back to sleep (for either (a) the time it takes to get to the next event or (b) indefinitely if there are no more events). The sleeping is handled with a WaitEv...

Handling abnormal Java program exits

Hello all, Suppose I have a Java application that opens a database connection. Normally I would add a connection.close() in a finally block, but this block wouldn't be executed in the case of a kill operation, or any other abnormal termination, would it? Are there any other precautions that I, as a programmer, can make in order to close...

Why shouldn't I use Process.GetCurrentProcess().Kill() to exit my WinForm application?

Right now, when the user want to exit my application, I do the few things I have to (ie disconnecting from the server, saving the user data...) and then I do the following : Exit all my mainloops using booleans abort the threads still running (typically, my server polling thread) kindly call Application.Exit(); This takes a few seco...

How do I obtain the exit code for a (Java) process with the Win32 API?

How can I obtain the JVM exit code (value of 'status' from call: System.exit(status)) from a Windows program which started this JVM? I tried to use result from the ShellExecute() call, but the result (42) was independent of real value of status. ...

Terminating a process created using spawnv

Hi everyone, I'm not experienced with processes at all, but what I'm set to to should be really simple. All I do is spawn a process like this: int spawnId = spawnv(_P_NOWAIT,"wgetlocal.exe",my_env); Now, what I want to do is kill this program after a certain time. However, the returned spawnId is not what I need when for instance call...

detect program termination (C, Windows)

I have a program that has to perform certain tasks before it finishes. The problem is that sometimes the program crashes with an exception (like database cannot be reached, etc). Now, is there any way to detect an abnormal termination and execute some code before it dies? Thanks. code is appreciated. ...

How to instantly termainate an un-supervised script on demand?

I have a GUI which resembles an interpreter. It allows the user to write a script in Jython (implementation of Python in Java) and run it whenever he wants. Apart from that, I also wish to allow the user to instantly terminate the run whenever he wants. Thing is, I don't really know how to do it. The script is being run on a different T...

Why won't my program terminate?

I have a .NET Compact Framework app that can runs on three windows machines (Desktop windows and two WinCE machines) and on the WinCE devices, the process never terminates on exit, even if I call Application.Exit(). Besides .NET, it uses one COM component (which does everything on the UI thread). If I break into the debugger after exitti...

Bulk Insert a File with a Text Field with Carriage Return (Enters)

Hi!, I´m having trouble with bulk insert a file that contains a field in data type text, and it holds enters and the delimiter for the fields are pipes "|" and the row terminator is "|\n" I get an error of truncation for the fields next to the text field. I think that the bulk insert thinks that the enters in the second field are the n...

Must i abort this thread? Waiting for namedpipes. How do i do this properly?

I have another question about this same code and keeping the pipe open after the client closes it But here i have a problem gracefully terminating my app. My main code is below. There are 2 problems. 1) I am using Thread.Abort and 2) This application doesnt actually end. I can set a breakpoint and see abort is called and step to the end...

How to run, monitor and stop a PHP script using SSH on a shared webserver?

Can a normal member (not an admin) of a shared webserver with (limited) SSH access run, monitor and stop a PHP script through SSH? If so, how would all three actions be done by the user? I tried to use the command "top", but it only listed actual top level processes, not PHP scripts. I have also managed to start a PHP script using the...

Android: Callback for an application launch

Is there a way I can be notified of an application launch and termination in Android? I mean, more like subscribing to the Activity Manager and then determining which applications have been started and stopped... ...

What can cause an abnormal program termination?

MFC application (uses SQLite3.dll for DB access, along with other DLLs for accessing hardware) terminates abnormally. There is no particular sequence of termination :( My application is a Single threaded Application Uses exception handling Uses more than 6 DLLs to access different hardwares Runs on WinXP SP2 Initially i thought it m...

Cleaning a buffer before termination

I'm writing a program similar to the producer-consumer problem. Here's my main code: public class PipeProcessor { private volatile boolean close = false; Pipe pipe; Output out; public PipeProcessor(Pipe pipe) { this.pipe = pipe; } public void run() { while(!close) { out.output(pipe.get()); } while(pipe.size() > 0) out.outp...

process termination C++

I have the following problem: I have an application (server that never ends) written in C++ running as a service containing inside the main thread also 3 threads (mainly doing IO). In the main loop I CATCH all possible exceptions. The process terminated and nothing was printed either by the main loop or by the threads themselves. I saw...

How can I add scala actors to an existing program without interfering with the normal termination behavior?

This program, after executing main(), does not exit. object Main { def main(args: Array[String]) { ... // existing code f() ... // existing code } def f() { import scala.actors.Actor._ val a = actor { loop { react { case msg: String => Syst...