OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Implements a multithreaded worker pool oriented for mapping jobs with | 5 """Implements a multithreaded worker pool oriented for mapping jobs with |
6 thread-local result storage. | 6 thread-local result storage. |
7 """ | 7 """ |
8 | 8 |
9 import Queue | 9 import Queue |
10 import sys | 10 import sys |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 def print_update(self): | 130 def print_update(self): |
131 """Prints the current status.""" | 131 """Prints the current status.""" |
132 with self.lock: | 132 with self.lock: |
133 if self.next_line == self.last_printed_line: | 133 if self.next_line == self.last_printed_line: |
134 return | 134 return |
135 line = '\r%s%s' % ( | 135 line = '\r%s%s' % ( |
136 self.next_line, | 136 self.next_line, |
137 ' ' * max(0, len(self.last_printed_line) - len(self.next_line))) | 137 ' ' * max(0, len(self.last_printed_line) - len(self.next_line))) |
138 self.last_printed_line = self.next_line | 138 self.last_printed_line = self.next_line |
139 sys.stdout.write(line) | 139 sys.stderr.write(line) |
140 sys.stdout.flush() | |
141 | 140 |
142 def increase_count(self): | 141 def increase_count(self): |
143 with self.lock: | 142 with self.lock: |
144 self.size += 1 | 143 self.size += 1 |
OLD | NEW |