@kshegunov Thanks. I can reproduce the same behavior with a single thread.
#include <QtCore> struct Object: QObject{ Q_OBJECT public slots: void foo(){ qDebug() << __LINE__; while(entered) qApp->processEvents(); qDebug() << __LINE__; QEventLoop loop; QTimer::singleShot(1000, &loop, SLOT(quit())); entered = true; loop.exec(); entered = false; qDebug() << __LINE__; } private: bool entered = false; }; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Object w; QTimer::singleShot(0, &w, SLOT(foo())); QTimer::singleShot(0, &w, SLOT(foo())); QTimer::singleShot(3000, &a, SLOT(quit())); a.exec(); qDebug() << __LINE__; } #include "main.moc"In fact, it has nothing to do with multi-threads. I have never studied Qt source code. It seems exec will not return before all slots finish. So, the code actually creates a dead lock.