tuoheng_algN/test/协程/协程3.py

11 lines
220 B
Python

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)