title: Triggering an exception in a main thread from a daemon thread in Python
body: <p>How do you trigger an exception in a main thread, running blocking code, from a daemon thread in Python?</p>
  
  <p>I have a daemon thread that periodically checks a database for a record indicating that its current process should terminate (i.e. the user has pressed the "cancel" button). In my main non-daemon thread, I'm running a blocking call to an external process that I can't easily modify to gracefully terminate. However, the main thread can gracefully handle a normal KeyboardInterrupt when I manually trigger one.</p>
  
  <p>So if my daemon thread receives the terminate command, how do I raise an exception in my main thread to terminate my process?</p>