previous | start | next

## Terminating Threads

- Thread terminates when `run` exits
- Sometimes necessary to terminate running thread
- Don't use deprecated `stop` method
- Interrupt thread by calling `interrupt`
- Calling `t.interrupt()` doesn't actually interrupt `t`; just sets a flag
- Interrupted thread must sense interruption and exit its `run` method
- Interrupted thread has chance to clean up

previous | start | next