algN/test/协程/协程3.py

11 lines
220 B
Python
Raw Permalink Normal View History

2025-08-23 10:12:26 +08:00
import time
from concurrent.futures import ThreadPoolExecutor
def aa(a):
print("aaaaaa")
time.sleep(2)
with ThreadPoolExecutor(max_workers=2) as t:
while True:
time.sleep(10)
t.submit(aa, 1)