File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed
Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change 77import shlex
88import subprocess
99import typing
10- import weakref
1110
1211_LLVM_VERSION = 19
1312_LLVM_VERSION_PATTERN = re .compile (rf"version\s+{ _LLVM_VERSION } \.\d+\.\d+\S*\s+" )
@@ -33,16 +32,14 @@ async def wrapper(
3332 return wrapper
3433
3534
36- _CORES_BY_LOOP : weakref .WeakKeyDictionary [
37- asyncio .AbstractEventLoop , asyncio .BoundedSemaphore
38- ] = weakref .WeakKeyDictionary ()
35+ _CORES : asyncio .BoundedSemaphore | None = None
3936
4037
4138def _get_cores () -> asyncio .BoundedSemaphore :
42- loop = asyncio . get_running_loop ()
43- if loop not in _CORES_BY_LOOP :
44- _CORES_BY_LOOP [ loop ] = asyncio .BoundedSemaphore (os .cpu_count ())
45- return _CORES_BY_LOOP [ loop ]
39+ global _CORES
40+ if _CORES is None :
41+ _CORES = asyncio .BoundedSemaphore (os .cpu_count () or 1 )
42+ return _CORES
4643
4744
4845async def _run (tool : str , args : typing .Iterable [str ], echo : bool = False ) -> str | None :
You can’t perform that action at this time.
0 commit comments