#include #include #include #include struct GlobalStatic { GlobalStatic() { // block forever forever {}; } }; Q_GLOBAL_STATIC(GlobalStatic, globalStatic) class WorkerThread : public QThread { Q_OBJECT void run() Q_DECL_OVERRIDE { forever { // qDebug() will block internally qDebug() << "Hi there"; } } }; class MainApp : public QObject { Q_OBJECT public slots: void lockStatic() { globalStatic(); } }; int main(int argc, char** argv) { QCoreApplication app(argc, argv); WorkerThread wt; wt.start(); MainApp m; QTimer::singleShot(0, &m, SLOT(lockStatic())); app.exec(); } #include "main.moc"