작성
·
75
답변 1
0
안녕하세요.
네 좋은질문입니다. 쓰레드는 작업이 된 후 상태값을 반환합니다. 쓰레드내에서 File I/O 작업등을 사용할 때 with를 사용하셔도 좋습니다.
메모리 누수문제는 고려하지 않아도 될 것 같아요.
파이썬 3.7, 3.8버전에서는 with문과 셧다운 메소드를 통해 중지시킬 수 있습니다
감사합니다.
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor(max_workers=2) as executor:
executor.shutdown(wait=True)