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. QThreadPool tutorial
Qt 6.11 is out! See what's new in the release blog

QThreadPool tutorial

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 2.3k Views 2 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.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by WhatIf
    #1

    Hi,

    I've been trying to find a tutorial about asynchronous tcp server. I found a youtube that explains how to implement asynchronous server using QThreadPool. The only problem, in a later video, the guy who did the tutorial mentioned that he used a function incorrectly and that all of the online tutorials use these functions incorrectly.

    Do you know of a trusted tutorial on the subject?

    This is an area where a code can be put together but if it has a mistake it might not show up until a significant corruption took place.

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

      Hi,

      Can you give more details about that erroneous use of a function and also which function is it ?

      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
      • W Offline
        W Offline
        WhatIf
        wrote on last edited by WhatIf
        #3

        moveToThread()

        This post explains how it's used incorrectly

        http://blog.qt.io/blog/2010/06/17/youre-doing-it-wrong/

        For this reason, I want to know if a trusted example of a QThreadPool used to create an asynchronous server so I start in the right direction.

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

          The latest documentation of QThread also explains this nicely.

          It depends a bit on what you expect to do with your server.

          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
          • W Offline
            W Offline
            WhatIf
            wrote on last edited by
            #5

            The problem with the documentation is that it shows snippets of code. I was hoping to find a simple working program to study and start to develop it further.

            jsulmJ kshegunovK 2 Replies Last reply
            0
            • W WhatIf

              The problem with the documentation is that it shows snippets of code. I was hoping to find a simple working program to study and start to develop it further.

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @WhatIf Did you check whether there is something in the example apps from Qt?

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

              1 Reply Last reply
              0
              • W WhatIf

                The problem with the documentation is that it shows snippets of code. I was hoping to find a simple working program to study and start to develop it further.

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

                See if this fits your requirements. It doesn't use a thread pool though, and starts a thread for each incoming connection so that may be a thing you'd want to change.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                1

                • Login

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