[Info-vax] Check if a process will auto-terminate
H Vlems
hvlems at freenet.de
Wed Apr 29 14:29:37 EDT 2009
On 29 apr, 12:02, "Stephen Davies" <no... at nowhere.com> wrote:
> "Joseph Huber" <joseph.hu... at NIRWANA.web.de> wrote in message
>
> news:gt7ntt$65s$1 at online.de...
>
> > The original question:
> > The reason is that I have updated a command file to spawn a subprocess
> > then
> > exit but some legacy calls to the command file already spawn the command
> > file, resulting in the sub-sub-process terminating almost immediately
> > because its parent terminates.
> > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> > This happens ONLY if SPAWN/NOWAIT was used, otherwise the parent does NOT
> > terminate before @CMD exits!
>
> Within CMD there is a SPAWN/NOWAIT.
> Therefore the problem happens with both "SPAWN @CMD" and "SPAWN/NOWAIT @CMD"
> However, the legacy calls do use "SPAWN/NOWAIT @CMD"
> So if there is a way to only detect this, it might still be useful.
Well this command procedure might work for you:
$ master=f$getjpi("","MASTER_PID")
$ write sys$output f$getjpi(master,"STATE")
$ exit
The output depends on the way it is run:
$ @s ! returns CUR
$ spawn @s ! returns HIB
$ spawn/nowait @s ! returns LEF
So there is a difference, though not a flawless solution. On a
multiprocessor system,
the third option may return CUR as well.
Hans
More information about the Info-vax
mailing list