title: How can I detect a hang in QEventLoop?
body: <p>I am not sure if the title of my question is formulated correctly, so to explain what I really mean, consider the following example:</p>
  
  <p>I create a <code>QApplication</code> and a <code>QWidget</code> with a <code>QPushButton</code> on it. Then I attach a handler to the click signal from the button that looks like this:</p>
  
  <pre><code>void MyWidget::on_pushButton_clicked(){
      //Never return
      while(true);
  }
  </code></pre>
  
  <p>Finally I start the event loop for the application and when I run the program and the window shows up click the button.</p>
  
  <p>This will in my case stall the entire application. So my question at this point is how can I "detect" that this kind of hangup has occurred in my application from the code?</p>
  
  <p>I know writing code that does not return in the signal handler is bad practice, I ask this question because I want to detect errors and recover from them, possibly by restarting the application altogether in an effort to improve resilience when in production.</p>
  
  <p>Thanks!</p>