Search code examples
c++iofibers

Designing efficient C++ code for fibers


How do I utilize fibers best in my game code? Should it only be used to manage nonpreemptive context-switches while loading resources (i.e. files from disk)? Or do I allow all types of game entities to run in a fiber? How do I schedule?

C++ or pseudo code samples greatly appreciated!


Solution

  • Don't? It's like a thread only with very little CRT support (unlike threads) and some hidden memory requirements like stack and registers.

    It may make non-system code easier to write but it complicates to an unjustifiable degree.