[rhel7/master] Wait for other threads to finish before sending ready (#1075103)
Vratislav Podzimek
vpodzime at redhat.com
Fri Mar 14 07:19:31 UTC 2014
On Thu, 2014-03-13 at 17:13 -0700, Brian C. Lane wrote:
> More threading fallout. In _initialize we set self._ready and send the
> hub the spoke ready message. But some of the other threads may not be
> quite done when the hub processes the message so it doesn't set the
> Source spoke sensitive. And it stays that way until another spoke is
> visited and _updateCompleteness is called on all the spokes.
>
> This adds a loop at the end of the _initialize thread to make sure
> self.ready will really be true when the hub gets the source spoke's
> ready message.
>
> Resolves: rhbz#1075103
> ---
> pyanaconda/ui/gui/spokes/source.py | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
> index 59ff82c..3fa3234 100644
> --- a/pyanaconda/ui/gui/spokes/source.py
> +++ b/pyanaconda/ui/gui/spokes/source.py
> @@ -646,6 +646,10 @@ class SourceSpoke(NormalSpoke):
> # FIXME
>
> self._ready = True
> + # Wait to make sure the other threads are done before sending ready, otherwise
> + # the spoke may not get be sensitive by _handleCompleteness in the hub.
> + while not self.ready:
> + time.sleep(1)
> hubQ.send_ready(self.__class__.__name__, False)
The busy-wait is probably okay here, it shouldn't cause any high CPU
consumption and replacing it with waiting for a Condition or Event would
probably cause more troubles than benefits. So ACK.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list