Subject: Re: [boost] [threadpool] relation with TR2 proposal
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2008-09-29 02:52:52
> Anthony Williams escribió:
>> Yes. The intention was that the free function launch_in_pool would use
>> an implementation-provided global thread pool that would be as smart
>> as the library implementor could manage.
>> e.g. I have a working prototype for Windows that initially runs one
>> pool thread per CPU. If a pool thread blocks on a future for a pool
>> task it suspends the current task and runs a new task from the pool.
> How do you do that? By re-executing the blocking task or using fibers?
I did just execute the new task on the same stack as the existing
task, but was mindful of the stack overflow problem that Johan
mentioned earlier. I've now changed my prototype to use fibers to
switch stacks. It's not perfect, as the nested task still has the same
thread ID as another currently-executing (but suspended) task. I'm
looking into ways to handle this, but it would really mean tying
*everything* to the thread pool implementation.
Like I said, it's a prototype.
-- 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