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

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< Coroutinestart (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)
 

Detailed Description

Helper for handling several coroutines.

Member Function Documentation

◆ erase()

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.

◆ poll()

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.


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