From: Zac Medico Date: Thu, 9 Feb 2012 09:12:40 +0000 (-0800) Subject: AsynchronousTask: exit listeners reverse order X-Git-Tag: v2.2.0_alpha86~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7a6c34cc6bd6eb20a97e05347f87a0157f4ae58a;p=portage.git AsynchronousTask: exit listeners reverse order 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. --- diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTask.py index 4aa598085..d57ccab2b 100644 --- a/pym/_emerge/AsynchronousTask.py +++ b/pym/_emerge/AsynchronousTask.py @@ -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)