About Nesting Threads



  • 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.



  • 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?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

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



  • 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.


  • Lifetime Qt Champion

    "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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.