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