Re: Is it Possible to Timeout in 4GL?
Posted in 1994
Hi, I have found a way to timeout even from the RING MENU. The trick in making the program timeout is as follows: Establish the MENU in a WHILE Loop. This is because, using the other approach of putting BEFORE MENU would cause the handler to be initialized only once. eg. DEFINE v_exit SMALLINT LET v_exit = FALSE WHILE(NOT v_exit) CALL initiatealarm(60) # --- 60 Seconds Timeout 'C' Func MENU "Options" COMMAND "Query" CALL initiatealarm(0) # --- Disable Timeout 'C' Func CALL QueryRecords() EXIT MENU COMMAND "ADD" CALL initiatealarm(0) # --- Disable Timeout 'C' Func CALL AddRecords() EXIT MENU COMMAND KEY(F11) # --- Exit Menu & Program LET v_exit = TRUE EXIT MENU END MENU END WHILE Platform Implemented: HP-UX/9.0 INFORMIX 5.01 ONLINE ---- e-mail : anand@sin-co.sin-ro.dhl.com DHL Singapore > >From : mail>ogj > To : tilh > >->:Alan Popiel (alan@po.den.mmc.com) answered: > >->: There is no way to do this completely within 4GL. I have done something > >->: similar thru the use of C subroutines called from 4GL. > >->: > >->: If you want to converse off-line, I can tell you some of the things I have > >->: done in a Sun-OS environment that come close to what you want. While I > >->: can't say for certain, I would assume that similar capabilities are > >->: available under HPUX. > [... Stuff Deleted ...] > We have used a similar approach for some time, with moderate success. > Here is how we do this: > > We link in a subroutine written i C that first establish a signal handler > for SIGALRM and then calls alarm(2). Then we periodically call it when > we want to establish timeouts. > > We use set_alarm(0) before any queries that might take long time, to disable > the alarm when the queries executes. [... Stuff Deleted ...]