kill(pid,0) sends a signal or not?

Sean McNeil sean at mcneil.com
Mon Jun 21 05:11:20 GMT 2004


I'm trying to trace down an issue with kse threads and firefox.  There
is an odd "trick" I haven't seen before:

 // kill(pid,0) is a neat trick to check if a
 // process exists
 if (kill(pid, 0) == 0 || errno != ESRCH)

Does this really work?  It is kind of odd that it I appear to get a
signal (if the traceback is accurate) with the signal set to 0:

#10 0x0000000202bc7a80 in thr_resume_wrapper (sig=0, siginfo=0x4,
    ucp=0x7fffffffd4c0) at /usr/src/lib/libpthread/thread/thr_kern.c:1112

This later causes a sig 11 and the program core dumps.

Any info on how threads are suppose to behave when a process does a
kill(pid,0) would be greatly appreciated.

Cheers,
Sean




More information about the freebsd-threads mailing list