emilib
|
This acts like a coroutine, but is implemented as a separate thread. More...
#include <coroutine.hpp>
Public Member Functions | |
Coroutine (const char *debug_name, std::function< void(InnerControl &ic)> fun) | |
~Coroutine () | |
Will stop() the coroutine, if not already done(). | |
void | stop () |
Abort the inner thread, if not done(). | |
void | poll (double dt) |
dt = elapsed time since last call in seconds. | |
bool | done () const |
Has the inner thread finished its execution? | |
Friends | |
class | InnerControl |
This acts like a coroutine, but is implemented as a separate thread.
emilib::cr::Coroutine::Coroutine | ( | const char * | debug_name, |
std::function< void(InnerControl &ic)> | fun | ||
) |
A running count of all coroutines will be appended to debug_name. The resulting name isused to name the inner thead and will also be written on errors.