 <p>QThreads can deadlock if they finish "naturally" during termination.</p> <p>For example in Unix, if the thread is waiting on a "read" call, the termination attempt (a Unix signal) will make the "read" call abort with an error code before the thread is destroyed.</p> <p>That means that the thread can still reach it's natural exit point while being terminated. When it does so, a deadlock is reached since some internal mutex is already locked by the "terminate" call.</p> <p>My workaround is to actually make sure that the thread <em>never</em> returns if it was terminated.</p> <pre><code>while( read(...) &gt; 0 ) { // Do stuff... } while( wasTerminated ) sleep(1); return; </code></pre> <p><em>wasTerminated</em> here is actually implemented a bit more complex, using atomic ints:</p> <pre><code>enum { Running, Terminating, Quitting }; QAtomicInt _state; // Initialized to Running void myTerminate() { if( _state.testAndSetAquire(Running, Terminating) ) terminate(); } void run() { [...] while(read(...) &gt; 0 ) { [...] } if( !_state.testAndSetAquire(Running, Quitting) ) { for(;;) sleep(1); } } </code></pre>