안드로이드 개발 질문/답변
(글 수 45,052)
도움말을 보면 아래와 같습니다.
아래 문장으로는 block 된 thread 를 깨워준다. 라는것 같은데요..
실제 몇몇 소스를 보니 호출시마다 toggle 처럼 pause 혹은 resume 을 수행하는것처럼 보입니다.
thread를 정지, 재시작 하고 싶을때 interrupt 만으로도 가능한가요?
아니면 wait, notify 로만 정지,재시작이 가능한건가요?
Posts an interrupt request to this Thread. The behavior depends on the state of this Thread:
Threads blocked in one ofObject'swait()methods or one ofThread'sjoin()orsleep()methods will be woken up, their interrupt status will be cleared, and they receive anInterruptedException.Threads blocked in an I/O operation of anInterruptibleChannelwill have their interrupt status set and receive anClosedByInterruptException. Also, the channel will be closed.Threads blocked in aSelectorwill have their interrupt status set and return immediately. They don't receive an exception in this case.



