qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r824894 - /qpid/trunk/qpid/cpp/src/posix/QpiddBroker.cpp
Date Tue, 13 Oct 2009 19:53:43 GMT
Author: aconway
Date: Tue Oct 13 19:53:43 2009
New Revision: 824894

URL: http://svn.apache.org/viewvc?rev=824894&view=rev
Log:
Have qpidd -q wait till the qpidd process exits before returning.

Modified:
    qpid/trunk/qpid/cpp/src/posix/QpiddBroker.cpp

Modified: qpid/trunk/qpid/cpp/src/posix/QpiddBroker.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/posix/QpiddBroker.cpp?rev=824894&r1=824893&r2=824894&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/posix/QpiddBroker.cpp (original)
+++ qpid/trunk/qpid/cpp/src/posix/QpiddBroker.cpp Tue Oct 13 19:53:43 2009
@@ -144,8 +144,16 @@
             return 1;
         if (myOptions->daemon.check)
             cout << pid << endl;
-        if (myOptions->daemon.quit && kill(pid, SIGINT) < 0)
-          throw Exception("Failed to stop daemon: " + qpid::sys::strError(errno));
+        if (myOptions->daemon.quit) {
+            if (kill(pid, SIGINT) < 0) 
+                throw Exception("Failed to stop daemon: " + qpid::sys::strError(errno));
+            // Wait for the process to die before returning
+            int retry=10000;    // Try up to 10 seconds
+            while (kill(pid,0) == 0 && --retry)
+                sys::usleep(1000);
+            if (retry == 0)
+                throw Exception("Gave up waiting for daemon process to exit");
+        }
         return 0;
     }
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message