summaryrefslogtreecommitdiffstats
path: root/openstack/common
diff options
context:
space:
mode:
authorBrian Elliott <bdelliott@gmail.com>2013-07-08 05:53:40 +0000
committerBrian Elliott <bdelliott@gmail.com>2013-07-08 05:53:40 +0000
commitdc8aa797c304251a3cb960f5274681a602ea077b (patch)
tree32acc1991b9b9ecee54a8b625c467f2e2ca3df10 /openstack/common
parent233f6e7411eacbe4ac2082ca034309b0e09435e9 (diff)
downloadoslo-dc8aa797c304251a3cb960f5274681a602ea077b.tar.gz
oslo-dc8aa797c304251a3cb960f5274681a602ea077b.tar.xz
oslo-dc8aa797c304251a3cb960f5274681a602ea077b.zip
Allow launchers to be stopped multiple times
Makes launchers play nicely with unit test fixtures in nova. bug 1199315 Change-Id: I00306821d1437324262ba8a3154b8a837bfb6434
Diffstat (limited to 'openstack/common')
-rw-r--r--openstack/common/service.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/openstack/common/service.py b/openstack/common/service.py
index d5c5604..6826c83 100644
--- a/openstack/common/service.py
+++ b/openstack/common/service.py
@@ -317,7 +317,9 @@ class Service(object):
def stop(self):
self.tg.stop()
self.tg.wait()
- self._done.send()
+ # Signal that service cleanup is done:
+ if not self._done.ready():
+ self._done.send()
def wait(self):
self._done.wait()
@@ -340,9 +342,10 @@ class Services(object):
service.stop()
service.wait()
- # each service has performed cleanup, now signal that the run_service
+ # Each service has performed cleanup, now signal that the run_service
# wrapper threads can now die:
- self.done.send()
+ if not self.done.ready():
+ self.done.send()
# reap threads:
self.tg.stop()