Re: How to halt a running program without losing data?
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Wed, 28 Dec 2005 20:18:24 GMT
*** Russell wrote:
It isn't fair to imply that any program in the scientific/engineering arena ought to be able to decide for itself in all circumstances when its task is done, by reaching some convergence criterion or running out of iterations. Nor is it fair to say that changing variables normally is done only when debugging. The software is merely a calculation tool assisting the user, and the need or desire to interact with it, by unsolicited interrupt (usually from the keyboard) depends on the nature of the application and how the user makes use of it. It is entirely reasonable to envision an application that allows the user to monitor progress of calculations, pause it to ask for intermediate results, and even make changes to parameters of the calculations based on what is seen before continuing. Such dialog with the user via the keyboard of course can be programmed into the application, but triggering the dialog requires that the application be able to ask at appropriate places in its calculations: "has the user signalled that he wishes to interact?"
I can say for certain that such an application is conceivable, because this is the nature of a chemical process simulator. In the case of the simulator I developed, the Escape key is used for signalling, first under DOS and currently under Windows. The interactive mode extends the utility of the software greatly. It lets the user explore changes in the process parameters. Since development of the real process, or at least the model of it, involves debugging at the application level, the interactive mode lets the user interact on demand.
The OP doesn't want simply to kill the run; that is done easily via the OS. It is the means of posting a signal to the application that is sought. The solution is outside the standard, as has been noted, and will be OS-dependent. In my case, I used the Lahey-provided service routine provided with the 16-bit F77L and with the 32-bit EM32 back in the 1980s for DOS. For Windows (Lahey LF95), I put together a routine that used an API call to see of the Escape key has been pressed. The simulator periodically calls the routine to see if it should begin dialog with the user or just continue calculations. I posted source for it the routine in the "code repository on the Lahey web site.
A more portable solution is to use an INQUIRE by file name and periodicially check for a specific file's existence. When the user wants to interrupt the program, he pushes the "create a file with some specific name" button on the keyboard. When the program is finished with the dialogue it deletes the file. It's a little more portable than using vendor specific solutions. But, until you get used to it, it's a little less intuitive than escape.
*** Hendrickson
.
- Follow-Ups:
- Re: How to halt a running program without losing data?
- From: *** Russell
- Re: How to halt a running program without losing data?
- From: Mr Hrundi V Bakshi
- Re: How to halt a running program without losing data?
- References:
- Re: How to halt a running program without losing data?
- From: Ron Shepard
- Re: How to halt a running program without losing data?
- From: *** Russell
- Re: How to halt a running program without losing data?
- Prev by Date: Re: How to halt a running program without losing data?
- Next by Date: Re: Wave that shook the world
- Previous by thread: Re: How to halt a running program without losing data?
- Next by thread: Re: How to halt a running program without losing data?
- Index(es):