Skip to content

Commit

Permalink
Update thread.py
Browse files Browse the repository at this point in the history
  • Loading branch information
GoodManWEN authored Dec 29, 2020
1 parent 19404ba commit 949057e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ThreadPoolExecutorPlus/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ def __init__(self, max_workers=None, thread_name_prefix='',
# Use this number because ThreadPoolExecutor is often
# used to overlap I/O instead of CPU work.
max_workers = DEFAULT_MAXIMUM_WORKER_NUM
if max_workers <= self._min_workers:
raise ValueError(f"max_workers must be greater than min_workers = {self._min_workers}")
if max_workers < 1:
raise ValueError(f"max_workers must be greater than min_workers , min_workers must be greater than 1")
elif 1 <= max_workers < self._min_workers:
self._min_workers = max_workers

if initializer is not None and not callable(initializer):
raise TypeError("initializer must be a callable")
Expand Down Expand Up @@ -320,4 +322,4 @@ def shutdown(self, wait=True):
if wait:
for t in self._threads:
t.join()
shutdown.__doc__ = _base.Executor.shutdown.__doc__
shutdown.__doc__ = _base.Executor.shutdown.__doc__

0 comments on commit 949057e

Please sign in to comment.