Http connexion from secondary thread

  • Hi

    I am trying to create a HTTP connexion from a secondary thread, while the object receiving the finished() signal is in the main thread. The idea here is to let the main thread do UI initialisations. In this case it seems that the finished() signal is no longer received, but no connect() error is seen. Could you help in solving this issue ?


  • Moderators

    Where do you connect the finished signal (in which thread) and in which thread the sending and receiving objects live? Is the connection type the proper one, i.e. Qt::QueuedConnection?

    Btw. the QNAM requests are asynchronous so there is usually no benefit in running them from another thread.

  • The finished signal is connected in the worker thread, started with QtConcurrent::run(). The object that generates the finished signal is also created in the worker thread. The connection type is the default one: Qt::AutoConnection

  • Moderators

    Ok then. Without some code I can only throw guesses - are you sure both the QNAM and the connected object are still alive when the signal is emitted? can you connect a lambda and see if it gets called?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.