From 7a6c34cc6bd6eb20a97e05347f87a0157f4ae58a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 9 Feb 2012 01:12:40 -0800 Subject: [PATCH] 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. --- pym/_emerge/AsynchronousTask.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.26.2