emilib
|
Helper for handling several coroutines. More...
#include <coroutine.hpp>
Public Member Functions | |
bool | empty () const |
size_t | size () const |
void | clear () |
Stop all running coroutines with no outside handles to them. | |
std::shared_ptr< Coroutine > | start (const char *debug_name, std::function< void(InnerControl &ic)> fun) |
You can save the returned handle so you can stop() or erase() it later. | |
bool | erase (const std::shared_ptr< Coroutine > &cr) |
void | poll (double dt) |
Helper for handling several coroutines.
bool emilib::cr::CoroutineSet::erase | ( | const std::shared_ptr< Coroutine > & | cr | ) |
Remove it from the set. If there are no more handles left for the routine, it will be stopped. Returns false iff the given handle was not found.
void emilib::cr::CoroutineSet::poll | ( | double | dt | ) |
poll all contained coroutines. dt = elapsed time since last call in seconds. It is safe to call clear(), start() and erase() on this CoroutineSet from within a coroutine.