* Help with trapping unix signals-DEC Fortran/OSF
@ 1995-02-21 8:28 Kenneth A. Cunefare
0 siblings, 0 replies; only message in thread
From: Kenneth A. Cunefare @ 1995-02-21 8:28 UTC (permalink / raw)
Consider the following code scraps, from various places in a rather large
program. The intent of the code is:
1) Enter a loop at a known point in the code. While in this loop, an
external shell script will send the STOP signal to the code, putting it to
sleep. The shell performs a number of functions, and then sends the CONT
signal to the program.
2) On receipt of the CONT signal, the signal handler MYHANDLER changes the
flag controlling the loop, such that the program con now proceed beyond the
loop.
The problem: If I don't have the write statement in the loop, the program
never recognizes that the variable RUNFLAG has changed state, and stays in
the loop forever. I do know that the flag is by changed in the signal
handler. I have tried a number of different evaluations/tests in the loop,
but the only thing that gets it to work is the bailing-wire-and-chewing-gum
fix of having the write statement in there.
The question: Why will this code not work without the write statement in the
loop?
I'm using Fortra 77 on a DEC Alpha 3000/600, with OSF V3.0 (Rev. 347).
In the main program:
LOGICAL RUNFLAG
COMMON /NASA0/ RUNFLAG
EXTERNAL MYHANDLER
C DIRECT THE HANDLER ROUTINE FOR CONT TO MYHANDLER
IRETURN=SIGNAL(19, MYHANDLER, -1)
In a subroutine to the main program:
LOGICAL RUNFLAG
COMMON /NASA0/ RUNFLAG
5 CONTINUE
WRITE(60,*) 'IN THE LOOP'
CALL FLUSH(60)
IF (.NOT.RUNFLAG) GOTO 5
The MYHANDLER routine:
SUBROUTINE MYHANDLER(ISIGNUM)
INTEGER ISIGNUM
CHARACTER*80 LINE
CHARACTER*8 SIGTIME
LOGICAL RUNFLAG
COMMON /NASA0/ RUNFLAG
CALL TIME(SIGTIME)
WRITE(61,12) SIGTIME,ISIGNUM
12 FORMAT(' AT ',A8,' PROGRAM RECIEVED SIGNAL ',I4)
RUNFLAG=.TRUE.
WRITE(61,*) 'RUNFLAG is now ', RUNFLAG
CLOSE(61)
RETURN
END
Dr. Kenneth A. Cunefare, Assistant Professor
Georgia Institute of Technology
ken.cunefare@me.gatech.edu
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1995-02-21 8:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-02-21 8:28 Help with trapping unix signals-DEC Fortran/OSF Kenneth A. Cunefare
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox