4

C++ under Linux (CentOS 6.3), using pthreads. gcc 4.7.

I am now maintaining a program where the primary thread does a blocking call to waitpid(-1,...) to reap any and all possible children.

In a thread spawned earlier from the main thread, I have code that does a fork()/execve() call with a waitpid(childpid,...) after the fork (the moral equivalent of system()).

I'm seeing VERY infrequent instances where the child thread's waitpid call just blocks forever.

Am I correct in assuming that there's a race condition if both of these waitpid calls are blocked and the child exits?

Michael Kohne
  • 11,888
  • 3
  • 47
  • 79

0 Answers0