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. How to clean signals in thread.
Qt 6.11 is out! See what's new in the release blog

How to clean signals in thread.

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.7k Views 3 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.
  • S Offline
    S Offline
    sergboec
    wrote on last edited by
    #1

    Yep, sounds strange, let me explain.
    I know that if I connect signal and slot between threads, it means that by default first thread will post some event to receiver thread event queue.
    All i want is to know is there any king of mechanism i can remove all events from thread's event queue, generated by particular emit signal in other thread.

    kshegunovK 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      AFAIK, it's not possible.

      Out of curiosity, why would you need that feature ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      0
      • S sergboec

        Yep, sounds strange, let me explain.
        I know that if I connect signal and slot between threads, it means that by default first thread will post some event to receiver thread event queue.
        All i want is to know is there any king of mechanism i can remove all events from thread's event queue, generated by particular emit signal in other thread.

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        @sergboec
        Probably you could hack around with installing an event filter and intercepting the QEvent::MetaCall events, but(!) you shouldn't do that in the first place.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          AFAIK, it's not possible.

          Out of curiosity, why would you need that feature ?

          S Offline
          S Offline
          sergboec
          wrote on last edited by
          #4

          @SGaist i got system that based on qt plugin system.
          Each plugin works asynchronously in his thread.
          I am using signals as communication mechanism between plugins.
          Some event from one plugin is received in second plugin and changes internal state of the second plugin.
          But while i processing changing internal state, some signals already arrived to second plugin. I don't need them in state i had just switched to.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Then why not just ignore them if you're in a given state ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 1 Reply Last reply
            0
            • SGaistS SGaist

              Then why not just ignore them if you're in a given state ?

              S Offline
              S Offline
              sergboec
              wrote on last edited by
              #6

              @SGaist it is a good option.
              but for now there is no difference between signals regardless of the state

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                What do you mean by "no difference" ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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