|
Boost : |
From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2008-05-08 11:51:59
"vicente.botet" <vicente.botet_at_[hidden]> writes:
>> If this isn't for worker threads in a thread pool, what is the purpose?
>>
>
> Imagine I have in my code a lot of threads that are created/destroyed
> dynamicaly. For performances purposes I decide to creates this threads using
> a thread factory which caches some idle threads instead of destroying them.
> Whay I want is to preserv as much as possible the interface, so the result
> of the thread factory must conform as much as possible to the thread
> interface. Note that may initial application had not the notion of thread
> group.
>
> The thread_pool I have used so far calls the function asynchronously,
> because the function will be stored on the queue of pending. With a thread
> cache either the threre is a cached_thread in the pool and we use it to
> launch the user function, either the chached_threader will crate a new one.
OK. That makes sense.
> In addition a cached thread should behaves as much as possible as a thread.
> A thread_pool is much more a multi_task scheduler than a thread factory.
>
> Maybe a thread_pool with the needed policies can give the same result. Why
> not?
> . Task type : provide the thread functionality
> . Scheduling Policy : immediate (Synchronous)
> . Size Policy creates a new one when no more available
>
> Do you know a thread_pool library allowing to implement the required
> behaviour?
No, sorry.
Anthony
-- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk