Coroutine Class Reference
HiCR
|
#include <coroutine.hpp>
Public Types | |
using | coroutineFc_t = std::function< void(void *)> |
Public Member Functions | |
__INLINE__ void | resume () |
__INLINE__ void | yield () |
__INLINE__ void | start (const coroutineFc_t &fc, void *const arg) |
__INLINE__ bool | hasFinished () |
Detailed Description
Abstracts the basic functionality of a coroutine execution
Member Typedef Documentation
◆ coroutineFc_t
using HiCR::backend::boost::Coroutine::coroutineFc_t = std::function<void(void *)> |
Defines the type accepted by the coroutine function
Member Function Documentation
◆ hasFinished()
|
inline |
A function to check whether the coroutine has finished execution completely
- Returns
- True, if the coroutine has finished; False, otherwise.
◆ resume()
|
inline |
Resumes the execution of the coroutine. The coroutine needs to have been started before this, otherwise undefined behavior is to be expected.
◆ start()
|
inline |
Creates the context of the coroutine.
This is separate from the class constructor to allow Just-in-time allocation of the stack. This enables the creation of many instances of this class, whereas only a few need to have an allocated stack at any given moment.
- Parameters
-
[in] fc Function to run by the coroutine [in] arg Argument (closure) to be passed to the function
◆ yield()
|
inline |
Yields the execution of the coroutine. The coroutine needs to be 'resumed' when running this function, otherwise undefined behavior is to be expected.
The documentation for this class was generated from the following file:
- /home/runner/work/HiCR/HiCR/include/hicr/backends/boost/coroutine.hpp
Generated by