반복문에서 안전한 lambda capture를 만드는 과정

변경되는 index를 붙잡지 않고 iteration별 고정 binding을 만든다.

  1. loop index

    다음 반복에서 값이 바뀐다

    mutable
  2. slot 복사

    현재 index를 새 int에 담는다

    effectively final
  3. value 선택

    해당 topic 참조를 고정한다

    capture
  4. Thread 생성

    slot-value pair를 출력한다

    independent

핵심: mutable array로 compile 제한을 우회하면 모든 task가 같은 box를 볼 수 있다.