diff options
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r-- | meta/lib/oe/utils.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 1658f3555d..a3b1bb1087 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -264,10 +264,17 @@ def execute_pre_post_process(d, cmds): | |||
264 | bb.note("Executing %s ..." % cmd) | 264 | bb.note("Executing %s ..." % cmd) |
265 | bb.build.exec_func(cmd, d) | 265 | bb.build.exec_func(cmd, d) |
266 | 266 | ||
267 | # For each item in items, call the function 'target' with item as the first | 267 | def get_bb_number_threads(d): |
268 | return int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1) | ||
269 | |||
270 | def multiprocess_launch(target, items, d, extraargs=None): | ||
271 | max_process = get_bb_number_threads(d) | ||
272 | return multiprocess_launch_mp(target, items, max_process, extraargs) | ||
273 | |||
274 | # For each item in items, call the function 'target' with item as the first | ||
268 | # argument, extraargs as the other arguments and handle any exceptions in the | 275 | # argument, extraargs as the other arguments and handle any exceptions in the |
269 | # parent thread | 276 | # parent thread |
270 | def multiprocess_launch(target, items, d, extraargs=None): | 277 | def multiprocess_launch_mp(target, items, max_process, extraargs=None): |
271 | 278 | ||
272 | class ProcessLaunch(multiprocessing.Process): | 279 | class ProcessLaunch(multiprocessing.Process): |
273 | def __init__(self, *args, **kwargs): | 280 | def __init__(self, *args, **kwargs): |
@@ -302,7 +309,6 @@ def multiprocess_launch(target, items, d, extraargs=None): | |||
302 | self.update() | 309 | self.update() |
303 | return self._result | 310 | return self._result |
304 | 311 | ||
305 | max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1) | ||
306 | launched = [] | 312 | launched = [] |
307 | errors = [] | 313 | errors = [] |
308 | results = [] | 314 | results = [] |