[PATCH 1/2] Add boolean as return to ThreadManager.wait
Jiri Konecny
jkonecny at redhat.com
Mon Mar 23 14:42:01 UTC 2015
ThreadManager method 'wait' now returns True if we waited on thread with
given name to finish, otherwise it returns False.
---
pyanaconda/threads.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/threads.py b/pyanaconda/threads.py
index a06f134..3a8d162 100644
--- a/pyanaconda/threads.py
+++ b/pyanaconda/threads.py
@@ -97,12 +97,15 @@ class ThreadManager(object):
"""Wait for the thread to exit and if the thread exited with an error
re-raise it here.
"""
+
+ ret_val = True
+
# we don't need a lock here,
# because get() acquires it itself
try:
self.get(name).join()
except AttributeError:
- pass
+ ret_val = False
# - if there is a thread object for the given name,
# we join it
# - if there is not a thread object for the given name,
@@ -111,6 +114,9 @@ class ThreadManager(object):
self.raise_if_error(name)
+ # return True if we waited for the thread, False otherwise
+ return ret_val
+
def wait_all(self):
"""Wait for all threads to exit and if there was an error re-raise it.
"""
--
2.1.0
More information about the anaconda-patches
mailing list