CF_Coroutine¶
Category: coroutine
GitHub: cute_coroutine.h
An opaque handle representing a coroutine.
Remarks¶
A coroutine is a function that can be paused and resumed. Coroutines are often used as an alternative way to implement state machines, or create gameplay-helper tools for control code logic/flow. Once a coroutine is created with cf_make_coroutine call cf_coroutine_resume to start running it. At any moment the coroutine can pause itself with cf_coroutine_yield. Then, later, someone else can call cf_coroutine_resume. The coroutine will then continue running just after the last call to cf_coroutine_yield. This makes a coroutine great for preserving state between yield/resume calls, for example to perform some complex action over multiple frames.
Related Pages¶
cf_coroutine_currently_running
CF_CoroutineFn
CF_CoroutineState
cf_make_coroutine
cf_destroy_coroutine
cf_coroutine_state_to_string
cf_coroutine_resume
cf_coroutine_yield
cf_coroutine_state
cf_coroutine_get_udata
cf_coroutine_push
cf_coroutine_pop
cf_coroutine_bytes_pushed
cf_coroutine_space_remaining