Skip to content

Commit 7701046

Browse files
authored
Update README.md
1 parent 6f9e626 commit 7701046

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ The reason why this pack exists is we would like to solve several specific pain
2222
Same api as concurrent.futures.ThreadPoolExecutor , with some more control function added.
2323

2424
##### set_daemon_opts(min_workers = None, max_workers = None, keep_alive_time = None)
25-
In order to guarantee same api interface , new features should be modfied after object created.
26-
Could change minimum/maximum activate worker num , and set after how many seconds will the idle thread terminated.
27-
By default , min_workers = 4 , max_workers = 256 on windows and 512 on linux , keep_alive_time = 100s.
25+
26+
    In order to guarantee same api interface , new features should be modfied after object created.
27+
    Could change minimum/maximum activate worker num , and set after how many seconds will the idle thread terminated.
28+
    By default , min_workers = 4 , max_workers = 256 on windows and 512 on linux , keep_alive_time = 100s.
2829

2930

3031
## Example
3132

32-
Very the same code in official doc [https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor-example](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor-example) , with executor replaced:
33+
Very the same code in official doc [#threadpoolexecutor-example](https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor-example) , with executor replaced:
3334
```Python3
3435
# requests_test.py
3536
import concurrent.futures
@@ -47,8 +48,8 @@ def load_url(url, timeout):
4748
return conn.read()
4849

4950
with ThreadPoolExecutorPlus.ThreadPoolExecutor(max_workers=5) as executor:
50-
# Try modify deamon options
51-
executor.set_daemon_opts(min_workers = 2 , max_workers = 10 , keep_alive_time = 60)
51+
# Try modify deamon options
52+
executor.set_daemon_opts(min_workers = 2 , max_workers = 10 , keep_alive_time = 60)
5253
future_to_url = {executor.submit(load_url, url, 60): url for url in URLS}
5354
for future in concurrent.futures.as_completed(future_to_url):
5455
url = future_to_url[future]
@@ -60,7 +61,7 @@ with ThreadPoolExecutorPlus.ThreadPoolExecutor(max_workers=5) as executor:
6061
print('%r page is %d bytes' % (url, len(data)))
6162
```
6263

63-
Same code in [https://docs.python.org/3/library/asyncio-eventloop.html?highlight=asyncio%20run_in_executor#executing-code-in-thread-or-process-pools](https://docs.python.org/3/library/asyncio-eventloop.html?highlight=asyncio%20run_in_executor#executing-code-in-thread-or-process-pools) with executor replaced:
64+
Same code in offcial doc [#executing-code-in-thread-or-process-pools](https://docs.python.org/3/library/asyncio-eventloop.html#executing-code-in-thread-or-process-pools) with executor replaced:
6465
```Python3
6566
# Runs on python version above 3.7
6667
import asyncio

0 commit comments

Comments
 (0)