• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    미해결

done, not_done 관련 질문입니다

21.11.22 22:18 작성 조회수 104

0

예제에서 나온

str(result.done)

str(result.not_done) 

에 관해서 질문드립니다.

concurrent.futures.wait()를 사용할 때는 2개의 튜플이 반환되고

각각 done과 not_done 이라는 이름이 붙어서 반환이 된다고 공식 문서에서 설명하고 있는데,

result.done과 result.not_done 과 같은 형식으로 함수나 메소드처럼 사용할 수 있는 건가요?

 

 

 

답변 1

답변을 작성해보세요.

0

concurrent.futures.wait(fstimeout=Nonereturn_when=ALL_COMPLETED)

Wait for the Future instances (possibly created by different Executor instances) given by fs to complete. Returns a named 2-tuple of sets. The first set, named done, contains the futures that completed (finished or cancelled futures) before the wait completed. The second set, named not_done, contains the futures that did not complete (pending or running futures).

 

맞습니다.

2개의 튜플이고 첫 번째 Set은 완료된 future, 두 번째 Set은 pending 또는 실행중인 future를

반환합니다.

 

보통은 메소드처럼 사용한다기 보다는 futures 담긴 작업들이 종료되기를 대기할 때 사용합니다.