Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to change the signal priority to multithread



  • I define a child thread, which have two slot functions triggered by two different signals from main UI thread.

    Assuming the two slot functions are fA, fB and the two signals are sA, sB. In genaral, sA was emitted in cycles. After a time, many sA was inserted the event queue of the child thread, the sB was emitted and insert the tail of the queue. The child thread will execute the fA and then fB according to the principle of coming later.

    But I want to call the fB slot function immediately if the sB signal is emitted, regardless of sA was emitted prior to sB.

    无标题.png


  • Lifetime Qt Champion

    @limy said in How to change the signal priority to multithread:

    But I want to call the fB slot function immediately if the sB signal is emitted, regardless of sA was emitted prior to sB.

    How should this work, even without threads - you emitted sA, so the thread is executing the slot for A. Now you're emitting sB - should the thread simply stop executing the slot for A? This is nonsense.


Log in to reply