Important: Please read the Qt Code of Conduct -

Signal/Slot syncing between two Qthread

  • Hi all,

    In my software, i'm using the QThread::wait(ms) method to wait a slot result of another QThread.

    A summary of my project is the following.
    -The Main thread is MainWindow class basic : public QMainWindow
    -The Second thread is created with the following method and this object is created with comm_modules class : public QObject

    The second thread or objet is created in the main thread constructor.

    Second Thread constructor :

        _thread = new QThread;

    I was tried the connect method with argument Qt::BlockingQueuedConnection but i have obtain a deadlock !

    Have you an simple idea to "wait" the finish signal of a slot ? Of an another slot

    Thanks a lot

  • Have you an simple idea to "wait" the finish signal of a slot ?

    QEventLoop loop;

  • @VRonin Good idea, but how to do with two different thread ?

  • Lifetime Qt Champion


    Since you only have two threads why not just use a counter that you decrement when the slot is called and when at zero, execute the rest of your initialization ?

  • I have just put this argument in 5nd argument of connect method.


Log in to reply