Author: leo
Date: Thu Oct 27 07:12:35 2005
New Revision: 9591
Modified:
trunk/classes/coroutine.pmc
Log:
coroutine needs its own clone method
Modified: trunk/classes/coroutine.pmc
==============================================================================
--- trunk/classes/coroutine.pmc (original)
+++ trunk/classes/coroutine.pmc Thu Oct 27 07:12:35 2005
@@ -71,6 +71,10 @@ pmclass Coroutine extends Sub need_ext {
Initializes the co-routine.
+=item C<PMC* clone()>
+
+Clone the couroutine.
+
=cut
*/
@@ -81,6 +85,18 @@ Initializes the co-routine.
PObj_custom_mark_destroy_SETALL(SELF);
}
+ PMC* clone () {
+ struct Parrot_coro * sub;
+ PMC* ret = pmc_new_noinit(INTERP, SELF->vtable->base_type);
+ PObj_custom_mark_destroy_SETALL(ret);
+ sub = mem_sys_allocate(sizeof(struct Parrot_coro));
+ memcpy(sub, PMC_sub(SELF), sizeof(struct Parrot_coro));
+ sub->name = string_copy(INTERP, sub->name);
+ PMC_coro_ASSIGN(ret, sub);
+ PMC_pmc_val(ret) = NULL;
+ return ret;
+ }
+
/*
=item C<void *invoke(void *next)>