summaryrefslogtreecommitdiff
path: root/cpp/src/posix
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-10-13 19:53:43 +0000
committerAlan Conway <aconway@apache.org>2009-10-13 19:53:43 +0000
commita5b7064eee9951b9bcb9dfe50895a62772b7bacf (patch)
treea12f18d122de54efb8eb9ed6d3879baa8355d858 /cpp/src/posix
parentd8fc8a501e9c082d22adb52a9cf1c482ba1261f0 (diff)
downloadqpid-python-a5b7064eee9951b9bcb9dfe50895a62772b7bacf.tar.gz
Have qpidd -q wait till the qpidd process exits before returning.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@824894 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/posix')
-rw-r--r--cpp/src/posix/QpiddBroker.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/cpp/src/posix/QpiddBroker.cpp b/cpp/src/posix/QpiddBroker.cpp
index aa934571be..3a20087062 100644
--- a/cpp/src/posix/QpiddBroker.cpp
+++ b/cpp/src/posix/QpiddBroker.cpp
@@ -144,8 +144,16 @@ int QpiddBroker::execute (QpiddOptions *options) {
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;
}