Re: Why waitpid() twice?

From: Henrik Nordström <henrik_at_henriknordstrom.net>
Date: Thu, 25 Feb 2010 20:04:47 +0100

tor 2010-02-25 klockan 11:47 -0700 skrev Alex Rousskov:

> 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?

There is actually only one.. the two is in two different processes.

Watch_child is the master process watching the actual worker process.

The sig_child handler is the helper pid reaper.

Regards
Henrik
Received on Thu Feb 25 2010 - 19:04:55 MST

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