summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-02-16 15:18:06 -0700
committerChris Larson <chris_larson@mentor.com>2011-02-16 15:19:55 -0700
commit1954f182687a0bd429175dda87f05d8a94bb403a (patch)
tree7fcf9b706b5078da97a0e186a00faa7ada54abd0
parentcd43144f0fe8487bb4dc8a7bd7be7a9ac071ecdd (diff)
downloadbitbake-1954f182687a0bd429175dda87f05d8a94bb403a.tar.gz
runqueue: pass a copy of the RunQueueStats to events
This avoids cases where the stats are modified after the event is fired but before it's dispatched to the UI. Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r--lib/bb/runqueue.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index db626e9f5..bbaeb38f4 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -46,6 +46,14 @@ class RunQueueStats:
self.active = 0
self.total = total
+ def copy(self):
+ obj = self.__class__(self.total)
+ obj.completed = self.completed
+ obj.skipped = self.skipped
+ obj.failed = self.failed
+ obj.active = self.active
+ return obj
+
def taskFailed(self):
self.active = self.active - 1
self.failed = self.failed + 1
@@ -1549,7 +1557,7 @@ class runQueueEvent(bb.event.Event):
def __init__(self, task, stats, rq):
self.taskid = task
self.taskstring = rq.rqdata.get_user_idstring(task)
- self.stats = stats
+ self.stats = stats.copy()
bb.event.Event.__init__(self)
class runQueueTaskStarted(runQueueEvent):