Skip to content

Commit b392ae5

Browse files
authored
Limit number of parallel jobs to 60 (#188)
1 parent dd16185 commit b392ae5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

wpiformat/wpiformat/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,16 @@ def main():
226226
help=
227227
"verbosity level 2 (prints names of processed files and tasks run on them)"
228228
)
229+
# mp.Pool() uses WaitForMultipleObjects() to wait for subprocess completion
230+
# on Windows. WaitForMultipleObjects() cannot wait on more then 64 events at
231+
# once, and mp uses a few internal events. Therefore, the maximum number of
232+
# parallel jobs is 60.
233+
cpu_count = min(60, mp.cpu_count())
229234
parser.add_argument(
230235
"-j",
231236
dest="jobs",
232237
type=int,
233-
default=mp.cpu_count(),
238+
default=cpu_count,
234239
help="number of jobs to run (default is number of cores)")
235240
parser.add_argument(
236241
"-clang",

0 commit comments

Comments
 (0)