[PATCH 2/3] Add a method for waiting for error handling to finish

Vratislav Podzimek vpodzime at redhat.com
Mon Jan 12 14:04:43 UTC 2015


Sometimes we need to wait for error handling in problematic threads finish. The
ThreadManager singleton has a good overview of threads and errors they caused or
didn't cause so it can easily serve such request.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/threads.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pyanaconda/threads.py b/pyanaconda/threads.py
index eea1da6..f116593 100644
--- a/pyanaconda/threads.py
+++ b/pyanaconda/threads.py
@@ -182,6 +182,17 @@ class ThreadManager(object):
         with self._objs_lock:
             return self._objs.keys()
 
+    def wait_for_error_threads(self):
+        """
+        Waits for all threads that caused exceptions. In other words, waits for
+        exception handling (possibly interactive) to be finished.
+
+        """
+
+        for thread_name in self._errors.keys():
+            thread = self._objs[thread_name]
+            thread.join()
+
 class AnacondaThread(threading.Thread):
     """A threading.Thread subclass that exists only for a couple purposes:
 
-- 
2.1.0



More information about the anaconda-patches mailing list