3 from collections.abc import Iterable, Mapping, Set # equivalent to typing.AbstractSet, not builtins.set
4 from threading import Lock, Semaphore, Thread
5 from typing import Any, Callable, Generic, Tuple, TypeVar
6 from weakref import ref
8 from ._base import Executor, Future
10 _threads_queues: Mapping[Any, Any]
12 _global_shutdown_lock: Lock
14 def _python_exit() -> None: ...
16 if sys.version_info >= (3, 9):
17 from types import GenericAlias
21 class _WorkItem(Generic[_S]):
25 kwargs: Mapping[str, Any]
26 def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
27 def run(self) -> None: ...
28 if sys.version_info >= (3, 9):
29 def __class_getitem__(cls, item: Any) -> GenericAlias: ...
31 if sys.version_info >= (3, 7):
33 executor_reference: ref[Any],
34 work_queue: queue.SimpleQueue[Any],
35 initializer: Callable[..., None],
36 initargs: Tuple[Any, ...],
40 def _worker(executor_reference: ref[Any], work_queue: queue.Queue[Any]) -> None: ...
42 if sys.version_info >= (3, 7):
43 from ._base import BrokenExecutor
44 class BrokenThreadPool(BrokenExecutor): ...
46 class ThreadPoolExecutor(Executor):
48 _idle_semaphore: Semaphore
53 _thread_name_prefix: str | None = ...
54 _initializer: Callable[..., None] | None = ...
55 _initargs: Tuple[Any, ...] = ...
56 if sys.version_info >= (3, 7):
57 _work_queue: queue.SimpleQueue[_WorkItem[Any]]
59 _work_queue: queue.Queue[_WorkItem[Any]]
60 if sys.version_info >= (3, 7):
63 max_workers: int | None = ...,
64 thread_name_prefix: str = ...,
65 initializer: Callable[..., None] | None = ...,
66 initargs: Tuple[Any, ...] = ...,
69 def __init__(self, max_workers: int | None = ..., thread_name_prefix: str = ...) -> None: ...
70 def _adjust_thread_count(self) -> None: ...
71 if sys.version_info >= (3, 7):
72 def _initializer_failed(self) -> None: ...