[Info-vax] Check if a process will auto-terminate
H Vlems
hvlems at freenet.de
Wed Apr 29 06:40:10 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.
This command procedure may do what you want:
$ ty s.com
$ master=f$getjpi("","MASTER_PID")
$ write sys$output f$getjpi(master,"STATE")
It returns different values, depending on the way it was run:
$ @s -> CUR
$ spawn @s -> HIB
$ spawn/nowait -> LEF
It is not perfect though. On a multiprocessor system the third
invocation may just as well return CUR.
But a return value of HIB is a lot less likely, though not impossible.
Hans
More information about the Info-vax
mailing list