Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.

Commit d47b732

Browse files
committed
Use process pool executor when tracker active
v120 toolchain require that source files read operations will happen in main thread
1 parent 2e13e11 commit d47b732

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clcache/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,13 @@ def scheduleJobs(cache: Any, compiler: str, cmdLine: List[str], environment: Any
16871687

16881688
exitCode = 0
16891689
cleanupRequired = False
1690-
with concurrent.futures.ThreadPoolExecutor(max_workers=jobCount(cmdLine)) as executor:
1690+
1691+
def poolExecutor(*args, **kwargs) -> concurrent.futures.Executor:
1692+
if isTrackerEnabled():
1693+
return concurrent.futures.ProcessPoolExecutor(*args, **kwargs)
1694+
return concurrent.futures.ThreadPoolExecutor(*args, **kwargs)
1695+
1696+
with poolExecutor(max_workers=min(jobCount(cmdLine), len(objectFiles))) as executor:
16911697
jobs = []
16921698
for (srcFile, srcLanguage), objFile in zip(sourceFiles, objectFiles):
16931699
jobCmdLine = baseCmdLine + [srcLanguage + srcFile]

pyinstaller/clcache_main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
import multiprocessing
12
from clcache.__main__ import main
3+
multiprocessing.freeze_support()
24
main()

0 commit comments

Comments
 (0)