Checking for new mail (and kill
iv at hal6000.UUCP
iv at hal6000.UUCP
Sat Sep 2 05:02:00 AEST 1989
/* ---------- "Re: Checking for new mail (and kill" ----------
Seth Robertson seth at ctr.columbia.edu:
> Sure, Modify checkmail so that does the following:
>
> if (kill(ppid,0))
> exit(1);
>
> So every so often, it checks to see if its parent is around. If
> it isn't, it performs honorable suicide.
|*------------------------------------------------------------
Jeff d'Arcy jdarcy at encore.com
>> This is an approach I'd tried earlier (I used SIGCHLD, actually) and
>> it worked OK, but I wasn't comfortable with the possibility that the
>> parent might try to do something with the signal instead of dropping
>> it. That's when I thought of comparing initial vs. current PPIDs.
\* End of text from hal6000:comp.unix.xenix ------------------
Actually, "kill(ppid,0)" does NOT send a signal to `ppid'. It merely
goes through all the checks for errors, and then returns OK / E???? .
It's a great way of checking to see if a process still exists. We use
such checks in resource locking code (is the owner of the lock still
running?) No more dead lock-file problems.
----
IV (aka John Elliott IV) Domain: iv at hal6000.Tandy.COM
Tandy Systems Software UUCP: ...!texbell!letni!hal6000!iv
900 Two Tandy Center or: ...!decvax!microsoft!trsvax!hal6000!iv
Fort Worth, TX 76102 Phone: 817/390-2701; 9:30am-6:00pm CST, M-F
More information about the Comp.unix.xenix
mailing list