What is the difference between Coroutine, Coroutine2 and Fiber? What is the difference between Coroutine, Coroutine2 and Fiber? multithreading multithreading

What is the difference between Coroutine, Coroutine2 and Fiber?


boost.coroutine is non-C++11 and therefore requires to use a private API from boost.context (reason because it is deprecated).

boost.coroutine2 and boost.fiber require C++11 and use callcc()/continuation (implements context switch, call-with-current-continuation) from boost.context.

boost.coroutine and boost.coroutine2 implement coroutines, while boost.fiber provides fibers (== lightweigt, coroperative userland-threads, green-threads, ...) with an API similar to std::thread.

The difference between coroutines and fibers is described in N4024: Distinguishing coroutines and fibers - in short: fibers are switched by an internal scheduler while coroutines use no internal scheduler.