diff options
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r-- | meta/lib/oe/utils.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index cf65639647..7982b2b511 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -483,8 +483,8 @@ from threading import Thread | |||
483 | 483 | ||
484 | class ThreadedWorker(Thread): | 484 | class ThreadedWorker(Thread): |
485 | """Thread executing tasks from a given tasks queue""" | 485 | """Thread executing tasks from a given tasks queue""" |
486 | def __init__(self, tasks, worker_init, worker_end): | 486 | def __init__(self, tasks, worker_init, worker_end, name=None): |
487 | Thread.__init__(self) | 487 | Thread.__init__(self, name=name) |
488 | self.tasks = tasks | 488 | self.tasks = tasks |
489 | self.daemon = True | 489 | self.daemon = True |
490 | 490 | ||
@@ -515,13 +515,12 @@ class ThreadedWorker(Thread): | |||
515 | 515 | ||
516 | class ThreadedPool: | 516 | class ThreadedPool: |
517 | """Pool of threads consuming tasks from a queue""" | 517 | """Pool of threads consuming tasks from a queue""" |
518 | def __init__(self, num_workers, num_tasks, worker_init=None, | 518 | def __init__(self, num_workers, num_tasks, worker_init=None, worker_end=None, name="ThreadedPool-"): |
519 | worker_end=None): | ||
520 | self.tasks = Queue(num_tasks) | 519 | self.tasks = Queue(num_tasks) |
521 | self.workers = [] | 520 | self.workers = [] |
522 | 521 | ||
523 | for _ in range(num_workers): | 522 | for i in range(num_workers): |
524 | worker = ThreadedWorker(self.tasks, worker_init, worker_end) | 523 | worker = ThreadedWorker(self.tasks, worker_init, worker_end, name=name + str(i)) |
525 | self.workers.append(worker) | 524 | self.workers.append(worker) |
526 | 525 | ||
527 | def start(self): | 526 | def start(self): |