Why waitpid() twice?

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Thu, 25 Feb 2010 11:47:01 -0700

Hello,

    Main.cc installs a sig_child handler that catches SIGCHILD and calls
waitpid(). Watch_child() in main.cc also calls waitpid(). Why are we
waiting for the same thing in two places? Does not that create a race
condition, possibly not exiting waitpid() in watch_child() if the signal
handler is executed first?

Can we just skip sig_child installation (or do nothing in the handler)
if we are going to call watch_child()?

I must be missing something here.

Thank you,

Alex.
Received on Thu Feb 25 2010 - 18:47:24 MST

This archive was generated by hypermail 2.2.0 : Fri Feb 26 2010 - 12:00:15 MST