[SOLVED] Signal between Thread - Order of signal respected?



  • I'm wondering if I send signals between 2 threads, are the signals sure to be received on the other thread in the same order that they are emited?

    E.g:
    @ connect(this, SIGNAL(sendSensors(QList<Sensor>)), hub, SLOT(setSensorList(QList<Sensor>)) );
    connect(this, SIGNAL(sendPowerCurve(PowerCurve)), hub, SLOT(setPowerCurve(PowerCurve)) );
    connect(this, SIGNAL(sendWheelCirc(int)), hub, SLOT(setWheelCirc(int)) );

    emit sendPowerCurve(account->powerCurve);
    emit sendWheelCirc(account->wheel_circ);
    emit sendSensors(lstSensor);@
    

    Am i sure that the method "setSensorList" from hub will get executed the last one?
    I'm using Signals/Slot to exchange data from Thread, probably not the cleanest way..
    Thanks!

    Edit: I added a few Qdebug and it seems to always be in the correct order, I think it's the queued signal mechanism?


  • Moderators

    From the "documentation":http://doc.qt.io/qt-5/qobject.html#connect-4 --

    [quote]If a signal is connected to several slots, the slots are activated in the same order as the order the connection was made, when the signal is emitted[/quote]


Log in to reply
 

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