The threading module (cont)
The Thread class
Daemon threads
- Normally, interpreter exits only when all threads have terminated.
- However, a thread can be flagged as a daemon thread (runs in background).
- Interpreter really only exits when all non-daemonic threads exit.
- Can use this to launch threads that run forever, but which can be safely killed.
|