
Am Samstag, 1. November 2008 23:03:07 schrieb Anthony Williams:
k-oli@gmx.de writes:
Am Samstag, 1. November 2008 19:35:23 schrieb Vicente Botet Escriba:
IMO, the implementation of the fork/join semantics do not need fibers. The wait/get functions can call to the thread_pool scheduler without context-switch. Which are the advantages of using fibers over calling recursively to the scheduler?
Please take alook into the example folder of threadpool. You will find two exmaples for recursivly calculate fibonacci. Configure the pool with tp::fibers_disabled and try to calulate fibonacci(3) with two worker-threads. Your application will block forever. Use the option tp::fiber_enabled and you can calculate any fibonacci number without blocking
I haven't looked at Oliver's use of Fibers, but you don't need to use fibers to do this.
The idea behind using fiber inside a threadpool is, that each worker-thread executes multiple fibers - fiber would yield its execution if future::get() would block (because future is not ready) Oliver