From 0ed50d22182873d604a6208c753a464605d514b8 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Mon, 7 Jul 2008 18:48:29 +0000 Subject: ForkedBroker: child process exits on completion. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@674587 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/ForkedBroker.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'qpid/cpp/src/tests') diff --git a/qpid/cpp/src/tests/ForkedBroker.h b/qpid/cpp/src/tests/ForkedBroker.h index 843c9ab8e2..c2f3346296 100644 --- a/qpid/cpp/src/tests/ForkedBroker.h +++ b/qpid/cpp/src/tests/ForkedBroker.h @@ -54,6 +54,8 @@ class ForkedBroker : public qpid::sys::ForkWithMessage { std::string prefix; public: + struct ChildExit {}; // Thrown in child processes. + ForkedBroker(const qpid::broker::Broker::Options& opts_, const std::string& prefix_=std::string()) : childPid(0), port(0), opts(opts_), prefix(prefix_) { fork(); } @@ -62,7 +64,7 @@ class ForkedBroker : public qpid::sys::ForkWithMessage { void stop() { if (childPid > 0) { ::kill(childPid, SIGINT); - //FIXME aconway 2008-07-04: ::waitpid(childPid, 0, 0); + ::waitpid(childPid, 0, 0); } } @@ -83,6 +85,10 @@ class ForkedBroker : public qpid::sys::ForkWithMessage { ready(boost::lexical_cast(broker->getPort())); // Notify parent. broker->run(); QPID_LOG(notice, "ForkedBroker exiting."); + + // Force exit in the child process, otherwise we will try to + // carry with parent tests. + exit(0); } uint16_t getPort() { return port; } -- cgit v1.2.1