OLD | NEW |
---|---|
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 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 """Generic utils.""" | 5 """Generic utils.""" |
6 | 6 |
7 import errno | 7 import errno |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import Queue | 10 import Queue |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
650 | 650 |
651 def _flush_terminated_threads(self): | 651 def _flush_terminated_threads(self): |
652 """Flush threads that have terminated.""" | 652 """Flush threads that have terminated.""" |
653 running = self.running | 653 running = self.running |
654 self.running = [] | 654 self.running = [] |
655 for t in running: | 655 for t in running: |
656 if t.isAlive(): | 656 if t.isAlive(): |
657 self.running.append(t) | 657 self.running.append(t) |
658 else: | 658 else: |
659 t.join() | 659 t.join() |
660 sys.stdout.full_flush() | 660 sys.stdout.flush() |
M-A Ruel
2011/03/13 20:45:48
No it's full_flush(), it's defined at line 379.
| |
661 if self.progress: | 661 if self.progress: |
662 self.progress.update(1, t.item.name) | 662 self.progress.update(1, t.item.name) |
663 assert not t.item.name in self.ran | 663 assert not t.item.name in self.ran |
664 if not t.item.name in self.ran: | 664 if not t.item.name in self.ran: |
665 self.ran.append(t.item.name) | 665 self.ran.append(t.item.name) |
666 | 666 |
667 def _run_one_task(self, task_item, args, kwargs): | 667 def _run_one_task(self, task_item, args, kwargs): |
668 if self.jobs > 1: | 668 if self.jobs > 1: |
669 # Start the thread. | 669 # Start the thread. |
670 index = len(self.ran) + len(self.running) + 1 | 670 index = len(self.ran) + len(self.running) + 1 |
(...skipping 29 matching lines...) Expand all Loading... | |
700 logging.info('Caught exception in thread %s' % self.item.name) | 700 logging.info('Caught exception in thread %s' % self.item.name) |
701 logging.info(str(sys.exc_info())) | 701 logging.info(str(sys.exc_info())) |
702 work_queue.exceptions.put(sys.exc_info()) | 702 work_queue.exceptions.put(sys.exc_info()) |
703 logging.info('Task %s done' % self.item.name) | 703 logging.info('Task %s done' % self.item.name) |
704 | 704 |
705 work_queue.ready_cond.acquire() | 705 work_queue.ready_cond.acquire() |
706 try: | 706 try: |
707 work_queue.ready_cond.notifyAll() | 707 work_queue.ready_cond.notifyAll() |
708 finally: | 708 finally: |
709 work_queue.ready_cond.release() | 709 work_queue.ready_cond.release() |
OLD | NEW |