coroutine
- noun
- /ˈkɔːrəˌtiːn/
- Specialized
- A coroutine lets a program pause its execution and later resume, allowing for smooth multitasking.
Examples
-
Coroutines alleviate this by putting stateful control in each place where it is needed.
Blog text (8) -
It's true that arranging the communication between coroutines is important.
Blog text (8) -
At the low level, a coroutine is just a code address combined with its call stack.
Blog text (8) -
You also need a chunk of RAM larger than your greatest possible stack depth per coroutine.
Blog text (8) -
Although there are different ways of implementing them, coroutines are best understood in the context of continuations.
Blog text (8) -
In a lot of ways, coroutines are like more deterministic threads.
Blog text (8) -
The code that catches input events is one coroutine; the rest of the program (including GUI updates) is the other one.
Blog text (8) -
I took a quick look at the design of Lua coroutines—that looks pretty nice.
Blog text (8) -
You can easily implement coroutines in terms of continuations; resuming a coroutine is just resuming the continuation of another piece of code.
Blog text (8) -
In programming, a coroutine can pause its operation to handle other tasks without starting over.
Surface Forms
Morphology
Etymology
Coroutine comes from co- ('together') and routine ('a set of steps' or 'a small program'). So a coroutine is a routine that can pause and resume to 'work together' with other routines, which is why coroutines help a program do many tasks without stopping.