src/pmc/coroutine.pmc - Coroutine PMC


Coroutine extends Sub to provide a subroutine that can stop in the middle, and start back up later at the point at which it stopped. See the Glossary for more information.


private0 call flip flop
private3 restore current sub after "flop". Used by generators.


static void print_sub_name(PARROT_INTERP, PMC *sub_pmc)
static function to print coroutine information (for tracing/debugging)
void init()
Initializes the coroutine.
PMC * clone()
Clones the coroutine.
void mark()
Marks all GC-able pmc elements as live.
void increment()
Signals the start of a yield.
void reset()
Resets the state of the coroutine, so that the next call will start at the first yield again.
void autoreset()
Sets a coroutine to auto-resetting, so it will never die when all yield states are exhausted. You can use autoreset(0) to turn it off again.Use this with care, as it might not do what you want!
opcode_t *invoke(void *next)
Swaps the "context" between the call to the coro and the yield back, until all yields are exhausted and the coro is dead.