diff options
author | Andrew Stitcher <astitcher@apache.org> | 2010-01-25 23:26:07 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2010-01-25 23:26:07 +0000 |
commit | 220cd21a6907b86c5b3e75ec6c5fd91d27599b56 (patch) | |
tree | 41d9710f667d3bb72a197174bead53e2cf8dd7d8 /cpp/src/tests/ForkedBroker.cpp | |
parent | 5395ddf86cbf6911d372a759cba4f0a755671f48 (diff) | |
download | qpid-python-220cd21a6907b86c5b3e75ec6c5fd91d27599b56.tar.gz |
Explicitly ignore SIGCHLD signal by sending it to an empty function so that
the boost_unit_test framework doesn't catch the signal when child processes exit
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@903008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/ForkedBroker.cpp')
-rw-r--r-- | cpp/src/tests/ForkedBroker.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/tests/ForkedBroker.cpp b/cpp/src/tests/ForkedBroker.cpp index e1a96c8e90..7c81d303fc 100644 --- a/cpp/src/tests/ForkedBroker.cpp +++ b/cpp/src/tests/ForkedBroker.cpp @@ -89,11 +89,28 @@ bool isLogOption(const std::string& s) { ); } +namespace { + void ignore_signal(int) + { + } +} + void ForkedBroker::init(const Args& userArgs) { using qpid::ErrnoException; port = 0; int pipeFds[2]; if(::pipe(pipeFds) < 0) throw ErrnoException("Can't create pipe"); + + // Ignore the SIGCHLD signal generated by an exitting child + // We will clean up any exitting children in the waitpid above + // This should really be neater (like only once not per fork) + struct ::sigaction sa; + sa.sa_handler = ignore_signal; + ::sigemptyset(&sa.sa_mask); + ::sigaddset(&sa.sa_mask, SIGCHLD); + sa.sa_flags = SA_NOCLDSTOP | SA_RESTART; + ::sigaction(SIGCHLD, &sa, 0); + pid = ::fork(); if (pid < 0) throw ErrnoException("Fork failed"); if (pid) { // parent |