Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Signal between Thread - Order of signal respected?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 930 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    maximus
    wrote on last edited by
    #1

    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?


    Free Indoor Cycling Software - https://maximumtrainer.com

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      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]

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved