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. About Nesting Threads

About Nesting Threads

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 1.4k 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.
  • includeI Offline
    includeI Offline
    include
    wrote on last edited by
    #1

    Hi,

    As you already know there is couple of approaches to Threading in Qt.(Inheriting QThread, using QThreadPool etc.) Well this question is not really about the code, it's about design.

    Let's say we have more than one QStringLists(like 5) and each of them has hundreds of elements. I want to do something time consuming with each QStringList.(parsing elements)

    Well I'm wondering is QtConcurrent or QThreadPool supports to use multiple available threads to parse the QStringList.

    in example,
    Our max thread count is 48.
    We have 3 lists. So 48 - 3 = 45 threads left.
    We need to do create 15 threads that run a parsing function for each list.
    The function takes an element of a list. So all 15 threads should work with different elements.

    Sorry for bad English.

    1 Reply Last reply
    0
    • includeI Offline
      includeI Offline
      include
      wrote on last edited by
      #2

      Concurrent Map and Map-Reduce
      QtConcurrent::map() applies a function to every item in a container, modifying the items in-place.

      I think this does what I wanted to do. or not?

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

        Hi and welcome to devnet,

        The only answer is; maybe. You don't explain what you want to do with your strings.

        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
        2
        • includeI Offline
          includeI Offline
          include
          wrote on last edited by include
          #4

          Well,

          I'm actually try to how much I can force multithreading. Maybe I can develop my webserver or interpreter. :)

          I think threading and network programming very important nowadays and in future.

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

            "How much I can force" ? What does that mean ?

            Well, for web server there's already the Cutelyst that you can take a look at.

            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
            1
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              QtConcurrent is not really "pushing it" as they will always use qMin(1,QThread::idealThreadCount()); threads (which btw is the most efficient)

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              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