title: How to terminate a thread when main program ends?
body: <p>If I have a thread in an infinite loop, is there a way to terminate it when the main program ends (for example, when I press <kbd><strong>Ctrl</strong></kbd>+<kbd><strong>C</strong></kbd>)?</p>