3 ms·
In Win32 at least, there is "FLS", Fiber Local Storage. But Fibers (Windows speak for coroutines, but not sure how they relate to C++ coroutines) are generally
by jstimpfle 4y ago
In Win32 at least, there is "FLS", Fiber Local Storage. But Fibers (Windows speak for coroutines, but not sure how they relate to C++ coroutines) are generally considered to be not worth the complexity.
- Matthias247 4y agoFibers would be stackful coroutines (every coroutine gets its own stack memory, and local variables inside a coroutine are placed onto that stack). Whereas C++ coroutines are stackless - local data in those gets placed into a magic object that is created somewhere by the compiler. Stackful vs stackless comes with a few pro's and con's - e.g. it's often argued that stackless requires less memory. However stackful coroutines can allow for preemption at arbitrary points instead of just at yield points.
- eco 4y agoTo expand on what you said, they recently decided to work on stackful coroutines for C++26 now that C++23 is final. You can just use one of the many libraries if you don't want to wait for the standard library version. Stackful coroutines didn't require any compiler support, unlike stackless so they've be available for a long time (stackless have also been around since C++20).