AsynchronousTask: exit listeners reverse order
authorZac Medico <zmedico@gentoo.org>
Thu, 9 Feb 2012 09:12:40 +0000 (01:12 -0800)
committerZac Medico <zmedico@gentoo.org>
Thu, 9 Feb 2012 09:12:40 +0000 (01:12 -0800)
This should fix a Scheduler hang which is triggered when that merge
queue, a SequentialTaskQueue, doesn't decrement its merge count until
after other exit listeners have already run.

pym/_emerge/AsynchronousTask.py

index 4aa5980857455979c57c9a09b0729f2cd8c1b96e..d57ccab2b6e10ac915bf143b962a873f34243aad 100644 (file)
@@ -129,7 +129,11 @@ class AsynchronousTask(SlotObject):
                        self._exit_listener_stack = self._exit_listeners
                        self._exit_listeners = None
 
-                       self._exit_listener_stack.reverse()
+                       # Execute exit listeners in reverse order, so that
+                       # the last added listener is executed first. This
+                       # allows SequentialTaskQueue to decrement its running
+                       # task count as soon as one of its tasks exits, so that
+                       # the value is accurate when other listeners execute.
                        while self._exit_listener_stack:
                                self._exit_listener_stack.pop()(self)