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 | e6253f43883264dc8157402b347a1a01dad265ff (patch) | |
| tree | 20ab8e6b2c5de51e32d277ee311434d85312feb7 /qpid | |
| parent | 8c1e8ae6633847a734bd8f3de8bf2943a7ced668 (diff) | |
| download | qpid-python-e6253f43883264dc8157402b347a1a01dad265ff.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@903008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
| -rw-r--r-- | qpid/cpp/src/tests/ForkedBroker.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/ForkedBroker.cpp b/qpid/cpp/src/tests/ForkedBroker.cpp index e1a96c8e90..7c81d303fc 100644 --- a/qpid/cpp/src/tests/ForkedBroker.cpp +++ b/qpid/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 |
