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. signal slot in sperate threads

signal slot in sperate threads

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 358 Views
  • 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.
  • L Offline
    L Offline
    Lior
    wrote on last edited by
    #1

    hi,

    I read a lot about signal slot mechanism, types of connections, and priority.

    I have simple example of ui main thread , controller thread and udp thread.

    The udp thread read the data with signal-slot readyread.

    I have other app that send the data in some different rates to test the performance.

    I added on the the data that i send a counter that i inc on every send.

    I have an issue that I don't know how to explain, i need help.

    **when i press with the mouse on the UI (anywhere on the form) , or only move the form , the udp thread lose packets , it seems that the udp thread is waiting to the events of the ui to finish.

    why there is any connection between the threads ??

    when I receive the data with while(1) and waitForReadyRead i don't lose packets **

    jsulmJ 1 Reply Last reply
    0
    • L Lior

      hi,

      I read a lot about signal slot mechanism, types of connections, and priority.

      I have simple example of ui main thread , controller thread and udp thread.

      The udp thread read the data with signal-slot readyread.

      I have other app that send the data in some different rates to test the performance.

      I added on the the data that i send a counter that i inc on every send.

      I have an issue that I don't know how to explain, i need help.

      **when i press with the mouse on the UI (anywhere on the form) , or only move the form , the udp thread lose packets , it seems that the udp thread is waiting to the events of the ui to finish.

      why there is any connection between the threads ??

      when I receive the data with while(1) and waitForReadyRead i don't lose packets **

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Lior said in signal slot in sperate threads:

      why there is any connection between the threads ??

      Why do you think there is a connection? If you did not connect both threads (signals/slots for example) in some way then there is no connection.
      First thing: UDP does not guarantee that everything arrives, use TCP if you need this guarantee.
      Then: what does your UI thread do? Do you have any code executed if you click on your UI? Does the UDP thread send data to the UI and if so does it wait for the UI to process it?

      You also could post your UDP and UI thread implementation , it would probably help more than just a description.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • L Offline
        L Offline
        Lior
        wrote on last edited by
        #3

        Hi, I will create a small example to my question above.

        For the mean time I read about the move to a thread and I reorganized the code.
        I think I used not correctly the thread creation and connecting signals.

        I understood that if I not using the move to thread the QObject that register to the signals (events) is the parent thread and therefore the mechanism is not working.

        The signal-slot documentation is not very clear and I have a lot of questions about multithresding.

        "Why do you think there is a connection?" - when i press on the UI i losing lots of packets. its clearly that the ui blocking the UDP thread.

        "UDP does not guarantee that everything arrives" i agrre, but the socket is on localhost, so basicly if the computer is not super busy i shuld not lose packets , and when i press on the UI, im losing lots of packets (more the 100).

        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