Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] Signal between Thread - Order of signal respected?
maximus last edited by
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?
@ 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..
Edit: I added a few Qdebug and it seems to always be in the correct order, I think it's the queued signal mechanism?
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]