[svn:parrot] r40490 - branches/auto_attrs/src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Tue Aug 11 13:35:54 UTC 2009
Author: NotFound
Date: Tue Aug 11 13:35:52 2009
New Revision: 40490
URL: https://trac.parrot.org/parrot/changeset/40490
Log:
set auto_attrs on Task and Timer PMCs
Modified:
branches/auto_attrs/src/pmc/task.pmc
branches/auto_attrs/src/pmc/timer.pmc
Modified: branches/auto_attrs/src/pmc/task.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/task.pmc Tue Aug 11 12:13:11 2009 (r40489)
+++ branches/auto_attrs/src/pmc/task.pmc Tue Aug 11 13:35:52 2009 (r40490)
@@ -20,7 +20,7 @@
#include "parrot/scheduler_private.h"
-pmclass Task need_ext {
+pmclass Task need_ext auto_attrs {
ATTR INTVAL id; /* The task ID. */
ATTR INTVAL priority; /* The priority of the task. */
ATTR FLOATVAL birthtime; /* The creation time stamp of the task. */
@@ -44,14 +44,12 @@
VTABLE void init() {
Parrot_Task_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Task_attributes);
+ (Parrot_Task_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
core_struct->id = 0;
core_struct->type = CONST_STRING(interp, "");
core_struct->subtype = CONST_STRING(interp, "");
@@ -123,14 +121,12 @@
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Task initializer must be a Hash");
- core_struct = mem_allocate_zeroed_typed(Parrot_Task_attributes);
+ core_struct = (Parrot_Task_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
elem = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "id"));
if (! PMC_IS_NULL(elem))
@@ -369,20 +365,6 @@
/*
-=item C<void destroy()>
-
-Free the task's underlying struct.
-
-=cut
-
-*/
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Mark any referenced strings and PMCs.
Modified: branches/auto_attrs/src/pmc/timer.pmc
==============================================================================
--- branches/auto_attrs/src/pmc/timer.pmc Tue Aug 11 12:13:11 2009 (r40489)
+++ branches/auto_attrs/src/pmc/timer.pmc Tue Aug 11 13:35:52 2009 (r40490)
@@ -57,7 +57,7 @@
#include "parrot/scheduler_private.h"
-pmclass Timer extends Task provides event need_ext {
+pmclass Timer extends Task provides event need_ext auto_attrs {
ATTR FLOATVAL duration; /* The duration of the timer pause */
ATTR FLOATVAL interval; /* How often to repeat */
ATTR INTVAL repeat; /* Whether to repeat:
@@ -75,14 +75,13 @@
VTABLE void init() {
Parrot_Timer_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Timer_attributes);
+ (Parrot_Timer_attributes *) PMC_data(SELF);
/* Set flags for custom GC mark and destroy. */
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
core_struct->id = 0;
core_struct->type = CONST_STRING(interp, "timer");
core_struct->subtype = CONST_STRING(interp, "");
@@ -179,8 +178,6 @@
VTABLE void destroy() {
Parrot_cx_delete_task(INTERP, SELF);
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
More information about the parrot-commits
mailing list