Skip to content

Commit bc4ad08

Browse files
committed
tighter interface
1 parent 74eb238 commit bc4ad08

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

conditional_futures/threadpool.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,25 @@ class ConditionalThreadPoolExecutor(Executor):
5858

5959
def __init__(
6060
self,
61-
max_workers: Optional[int] = None,
62-
**kwargs: Any,
61+
max_workers: int | None = None,
62+
thread_name_prefix: str = '',
63+
initializer: Callable[..., object] | None = None,
64+
initargs: tuple[Any, ...] = (),
6365
) -> None:
6466
self._max_workers = max_workers
65-
self._kwargs = kwargs
67+
self._thread_name_prefix = thread_name_prefix
68+
self._initializer = initializer
69+
self._initargs = initargs
6670
self._executor: Executor
6771

6872
def __enter__(self) -> 'ConditionalThreadPoolExecutor':
6973
self._executor = (
70-
ThreadPoolExecutor(max_workers=self._max_workers, **self._kwargs)
74+
ThreadPoolExecutor(
75+
max_workers=self._max_workers,
76+
thread_name_prefix=self._thread_name_prefix,
77+
initializer=self._initializer,
78+
initargs=self._initargs,
79+
)
7180
if is_no_gil()
7281
else SingleThreadExecutor()
7382
)

0 commit comments

Comments
 (0)