1
0
Fork 0
firefox/testing/web-platform/tests/tools/manifest/mputil.py
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

14 lines
587 B
Python

import multiprocessing
import sys
def max_parallelism() -> int:
cpu_count = multiprocessing.cpu_count()
if sys.platform == 'win32':
# On Python 3 on Windows, using >= MAXIMUM_WAIT_OBJECTS processes
# causes a crash in the multiprocessing module. Whilst this enum
# can technically have any value, it is usually 64. For safety,
# restrict manifest regeneration to 56 processes on Windows.
#
# See https://bugs.python.org/issue26903 and https://bugs.python.org/issue40263
cpu_count = min(cpu_count, 56)
return cpu_count