From dc8aa797c304251a3cb960f5274681a602ea077b Mon Sep 17 00:00:00 2001 From: Brian Elliott Date: Mon, 8 Jul 2013 05:53:40 +0000 Subject: Allow launchers to be stopped multiple times Makes launchers play nicely with unit test fixtures in nova. bug 1199315 Change-Id: I00306821d1437324262ba8a3154b8a837bfb6434 --- openstack/common/service.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'openstack/common') 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() -- cgit