Re: [Interest] QThreadPool - global instance or custom one

2017-01-20 Thread Frank Rueter | OHUfx

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 >:


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 
http://lists.qt-project.org/mailman/listinfo/interest





___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThreadPool - global instance or custom one

2017-01-20 Thread Bo Thorsen
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 :

> 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
> http://lists.qt-project.org/mailman/listinfo/interest
>
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThreadPool - global instance or custom one

2017-01-19 Thread Frank Rueter | OHUfx

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
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] QThreadPool - global instance or custom one

2017-01-19 Thread Thiago Macieira
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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] QThreadPool - global instance or custom one

2017-01-19 Thread Frank Rueter | OHUfx

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?
I.e. the docs all tend to refer to the global instance but they don't 
say anything about creating your own.


Are there any pros and cons?

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


Any insight on this?

Cheers,
frank

--
ohufxLogo 50x50  	*vfx compositing 
 | *workflow customisation and 
consulting * *


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest