| parrotcode: Co-Routine PMC | |
| Contents | PMCs | 

src/pmc/coroutine.pmc - Co-Routine PMC

Coroutine extends Continuation 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.


void init()PMC *clone()void destroy()    void destroy() {
        Parrot_coro *sub = PMC_coro(SELF);
        if (sub->ctx)
            Parrot_free_context(interp, sub->ctx, 0);
        SUPER();
    }
    PMC *clone() {
        Parrot_coro *sub    = mem_allocate_typed(Parrot_coro);
        PMC         *ret    = pmc_new_noinit(INTERP, SELF->vtable->base_type);
        PObj_custom_mark_destroy_SETALL(ret);
        PMC_struct_val(ret) = sub;
        PMC_pmc_val(ret)    = PMCNULL;
        memcpy(sub, PMC_sub(SELF), sizeof (Parrot_coro));
        sub->name           = string_copy(INTERP, sub->name);
        return ret;
    }
opcode_t *invoke(void *next)void mark()
Initial version by Melvin on 2002/06/6.
|  |   |