emilib
Public Member Functions | Friends | List of all members
emilib::cr::Coroutine Class Reference

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
 

Detailed Description

This acts like a coroutine, but is implemented as a separate thread.

Constructor & Destructor Documentation

◆ Coroutine()

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.


The documentation for this class was generated from the following file: