[PATCH 1/2] Add boolean as return to ThreadManager.wait
Martin Kolman
mkolman at redhat.com
Tue Mar 24 13:28:39 UTC 2015
On Mon, 2015-03-23 at 15:42 +0100, Jiri Konecny wrote:
> 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.
> """
Nice idea, ACK! :)
More information about the anaconda-patches
mailing list