
k-oli@gmx.de writes:
Am Montag, 29. September 2008 08:52:52 schrieb Anthony Williams:
joaquin@tid.es writes:
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
AFAIK the coroutine library in the vault does also stack switching. Are fibers/stack switching supported by other platforms (HP/UX, MacOS etc.)?
I haven't looked into it yet, so I don't know. 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