Thanks for confirming Bo, I will adjust my code accordingly.
On 20/01/17 10:36 PM, Bo Thorsen wrote:
I have exactly the same rule for my coding as Thiago does. And my
answer would be the same for this. If one of the models have jobs that
could hurt the performance of the other jobs, give it a pool of it's
own. If not, you can share.
Bo.
2017-01-20 4:44 GMT+01:00 Frank Rueter | OHUfx <fr...@ohufx.com
<mailto:fr...@ohufx.com>>:
Great, thanks for the quick reply and confirmation.
One more question: Would you create one QThreadPool instance for
the entire application or create new instances as you go (from
within different modules). Does it matter?
Cheers,
frank
On 20/01/17 3:29 PM, Thiago Macieira wrote:
On sexta-feira, 20 de janeiro de 2017 11:59:31 PST Frank
Rueter | OHUfx wrote:
Hi all,
I have started using QThreadPool for the first time and am
wondering if
it's save/recommended to create my own instance of it or
to always use
the global instance?
The rule I use is that you should use your own pool if you
plan on launching
tasks that may block, but it's ok to use the global one if you
need to run
things that run as fast as they can without blocking.
QHostInfo uses its own thread pool because it calls a blocking
function that
is known to sometimes take 30 seconds to return (getaddrinfo).
In my case my app will run inside a host application, so
my gut feeling
says to create my own thread pool so I don't accidentally
hijack the
host application's pool, but I may be wrong?!
You're probably right. QHostInfo's example also matches your
thinking: Qt's
behind-the-scenes usage should not affect the main
application's ability to
use the global thread pool.
_______________________________________________
Interest mailing list
Interest@qt-project.org <mailto:Interest@qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest
<http://lists.qt-project.org/mailman/listinfo/interest>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest