title: QThread always stuck in wait
body: <p>I am trying to use <code>QThread</code> to call a function in another thread without having the UI to freeze. I am using <strong>QT5.11.2</strong> on both <strong>windows</strong> and <strong>linux</strong>.</p>
  <p>Everything works fine on windows but the wait() function for <code>QThread</code> never returns no matter what.</p>
  <p>I use <strong>RHEL7</strong> on linux</p>
  <p>Here is what I am doing:</p>
  <pre><code>void MainWidget::configure_click(double value)
  {
      QThread *myThread = QThread::create([this, value]{ Configure(value); });
      dsoThread-&gt;setObjectName(&quot;My Configure Thread&quot;);
      QObject::connect(myThread, &amp;QThread::finished, [](){ qDebug()&lt;&lt; &quot;Configure Thread has finished&quot;;});  //  This is never printed
  
      myThread-&gt;start();
      myThread-&gt;wait();  //  Never returns from this
      myThread-&gt;quit();
      myThread-&gt;deleteLater();
  }
  </code></pre>
  <p>My <code>Configure</code> function prints its start and finish and both lines are being printed on run time</p>
  <pre><code>void MainWidget::Configure(double value)
  {
      qDebug() &lt;&lt; QThread::currentThread() &lt;&lt; &quot; started&quot;;
      
      //  Code to execute
  
      qDebug() &lt;&lt; QThread::currentThread() &lt;&lt; &quot; finished&quot;;
  }
  </code></pre>
  <p>I even read that <code>quit()</code> forces the thread to stop, so just for testing I tried switching <code>quit()</code> and <code>wait()</code> like so</p>
  <pre><code>    myThread-&gt;quit();
      myThread-&gt;wait();  //  Never returns from this either
      myThread-&gt;deleteLater();
  </code></pre>
  <p>I even tried looping the <code>isRunning()</code> function instead of <code>wait()</code> but I got the same results</p>
  <pre><code>    while(myThread-&gt;isRunning())  //  Same goes for !isFinished()
      {
          //  Do nothing
      }
  </code></pre>
  <p>It seems like no matter what the thread never knows that it was finished.</p>
  <p>What can I do to either solve this problem or to check why this is happening?</p>