Change 16088

ShadauxCat (ShadauxCat)
ShadauxCat committed this change into //guest/ShadauxCat/Sprawl/Mainline under Review 16089
View Review
Download .zip
Coroutine improvements:

- Yield-only coroutine (aka "generator") can now be iterated using range-based for. (Other coroutine types cannot as it makes no sense - they either do not return a value (nothing to iterate) or they require a value to be sent back (operator++ is insufficient and the call must be made explicitly by the user, not the compiler))
- Moved CoroutineState to a slightly more accessible location
- Added optional preprocessor macros to simplify working with coroutines: yield(), receive(), and yield_receive() depending on the type of coroutine being used.
- Added missing Yield() and Receive() static functions accepting move parameters. Coroutines had non-static functions for that, but the static ones were missing.

#review-16089
  • Files 3
  • Comments 0
3 edited 0 added 0 deleted
UnitTests/UnitTests_Thread.cpp#8
Loading...
threading/coroutine.cpp#5
Loading...
threading/coroutine.hpp#6
Loading...
Tip: Use n and p to cycle through the changes.