You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2008/07/07 20:48:30 UTC

svn commit: r674587 - /incubator/qpid/trunk/qpid/cpp/src/tests/ForkedBroker.h

Author: aconway
Date: Mon Jul  7 11:48:29 2008
New Revision: 674587

URL: http://svn.apache.org/viewvc?rev=674587&view=rev
Log:
ForkedBroker: child process exits on completion.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/tests/ForkedBroker.h

Modified: incubator/qpid/trunk/qpid/cpp/src/tests/ForkedBroker.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/tests/ForkedBroker.h?rev=674587&r1=674586&r2=674587&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/tests/ForkedBroker.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/ForkedBroker.h Mon Jul  7 11:48:29 2008
@@ -54,6 +54,8 @@
     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 @@
     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 @@
         ready(boost::lexical_cast<std::string>(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; }