| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Timing out a REXX program |
Phil Crown wrote in a message to Mike Bilow:
MB> I have a situation in which I want to run a REXX script periodically,
MB> but with the ability to time out if something goes wrong. For
MB> example, I have a program (BinkleyTerm) which is started from a batch
MB> file and which is usually running, but which exits with certain
MB> errorlevels at scheduled times. One of these errorlevels causes the
MB> parent batch file to run a particular REXX script. Because there are
MB> certain real-time constraints, I need to be able to limit the amount
MB> of time that the REXX script runs, killing it ungracefully if
MB> necessary as a last ditch effort to keep the system running.
PC> How about using a timer in the REXX script itself?
PC> call time('e') /* start the timer */
PC> call time('r') /* returns elapsed secs since time('e') */
PC> if result > MAXTIMEALLOWED then ...
This will not achieve what I want. The goal is to time out a Rexx function
call -- in the RXFTP library, as it happens -- if it takes too long. The
idea is that I am starting an FTP session and do not want to hang forever
if the FTP server goes away unilaterally. Ideally, the RXFTP library would
have the necessary timeout facility built into it, but it doesn't. I am
willing to have the whole Rexx program die if a timeout expires; I just
want to guarantee that the Rexx program terminates somehow within a
specified worst case maximum amount of time. If the Rexx program is still
running well enough to make calls to the time() function, then I don't need
to kill it.
MB> The second approach is to devise some sort of REXX DLL which the REXX
MB> script could use to set a time out on itself. The problem here is
PC> That's what time('e')/time('r') do.
PC> There is also a freeware program called GO_15.ZIP, that can
PC> kill tasks by typing 'go k taskname.cmd' but it won't kill
PC> the parent (ie. cmd.exe)
Again, if you issue a DosKillProcess() against the Rexx program, you
actually kill CMD.EXE. If there is a parent batch which calls the Rexx
program, then this kills the parent batch also. I suppose I can get around
this by running a second copy of CMD.EXE or something, but this is not the
key problem.
What I am thinking about implementing with the DLL is a Rexx function such
as RxtSetTimeout(), which would return immediately. This would start some
sort of asynchronous timer that, upon expiration, would cause the Rexx
program to be killed. The Rexx program could make periodic checkpoint
calls into the DLL to notify the timeout routine that everything was fine,
and this would reset the timeout timer. If, however, the DLL did not hear
from the Rexx program periodically, the DLL would assume that the Rexx
program was hung and kill it.
-- Mike
---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955 SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809 @PATH: 323/107 170/400 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.