diff options
-rw-r--r-- | lib/bb/utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py index ad13d0433..ebee65d3d 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -1142,7 +1142,10 @@ def get_referenced_vars(start_expr, d): def cpu_count(): - return multiprocessing.cpu_count() + try: + return len(os.sched_getaffinity(0)) + except OSError: + return multiprocessing.cpu_count() def nonblockingfd(fd): fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK) |