]> git.llucax.com Git - software/pymin.git/commitdiff
Add ProcessManager.restart() method to block until the restart is done.
authorLeandro Lucarella <llucax@gmail.com>
Sun, 18 Nov 2007 18:12:07 +0000 (15:12 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Sun, 18 Nov 2007 18:12:07 +0000 (15:12 -0300)
pymin/procman.py

index 12c269cb564146f97a306cc320a4222e5b18297a..5cea4d4e1760989126cb77d94483cc493b551e45 100644 (file)
@@ -86,6 +86,15 @@ class ProcessManager:
         assert name in self.namemap
         self.namemap[name].stop()
 
+    def restart(self, name):
+        logging.debug(u'ProcessManager.restart(%s)', name)
+        if name in self.namemap:
+            self.namemap[name].stop()
+            self.namemap[name].wait()
+            self.namemap[name].restart()
+        else:
+            self.namemap[name].start()
+
     def kill(self, name, signum):
         assert name in self.namemap
         self.namemap[name].kill(name, stop)