[SOLVED] Running a blocking operation with QtConcurrent in case of Qt 5.4?



  • Hallo.

    Beg your pardon if my question is stupid.

    I read on http://woboq.com/blog/qthread-you-were-not-doing-so-wrong.html
    that one should not run a blocking operation with QtConcurrent .

    Is this restriction still valid for Qt 5.4 ?

    Thanks in advance for your answers.



  • It really depends on your application. As the guy in the link said, QtConcurrent uses a thread pool. If you need to have many blocking operations running simultaneously, soon you will run out of threads and new requests will be queued. That might not be the desired behavior for some applications, but if you have a single blocking operation and just wants to keep the UI free to show some updates or whatever, I don't see any real problem here.



  • @Leonardo said:

    thread pool

    Thanks.

    But why should I not be able to run out of threads if I use more low level QThread
    instead of QtConcurrent?



  • Because QThread uses no thread pool. It is the thread itself.



  • @Leonardo

    Ok. Thanks.
    I mark the theme as SOLVED.


Log in to reply
 

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