Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

A few small cleanups to scheduler and schedulermessage PMCs. No funct…

…ional changes
  • Loading branch information...
commit 33a45e388f3ca9f329ac61d32d0970ea163a5947 1 parent 78cb477
@Whiteknight Whiteknight authored
Showing with 12 additions and 16 deletions.
  1. +5 −3 src/pmc/scheduler.pmc
  2. +7 −13 src/pmc/schedulermessage.pmc
View
8 src/pmc/scheduler.pmc
@@ -59,14 +59,17 @@ Initializes a concurrency scheduler object.
/* Set up the core struct. */
core_struct->id = 0;
+ core_struct->next_task_id = 0;
+ core_struct->interp = INTERP;
+
+ /* TODO: Do we need to eagerly create all these PMCs, or can we create
+ them lazily on demand? */
core_struct->handlers = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
core_struct->messages = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
core_struct->task_queue = Parrot_pmc_new(INTERP, enum_class_PMCList);
core_struct->foreign_tasks = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
core_struct->alarms = Parrot_pmc_new(INTERP, enum_class_PMCList);
core_struct->all_tasks = Parrot_pmc_new(INTERP, enum_class_Hash);
- core_struct->next_task_id = 0;
- core_struct->interp = INTERP;
MUTEX_INIT(core_struct->task_queue_lock);
@@ -75,7 +78,6 @@ Initializes a concurrency scheduler object.
}
-
/*
=item C<void init_pmc(PMC *data)>
View
20 src/pmc/schedulermessage.pmc
@@ -46,9 +46,9 @@ Initialize a concurrency scheduler message object.
PObj_custom_mark_SET(SELF);
/* Set up the core struct. */
- core_struct->id = 0;
- core_struct->type = CONST_STRING(INTERP, "");
- core_struct->data = PMCNULL;
+ core_struct->id = 0;
+ core_struct->type = CONST_STRING(INTERP, "");
+ core_struct->data = PMCNULL;
}
/*
@@ -113,11 +113,9 @@ Retrieve the message ID.
*/
VTABLE INTVAL get_integer() {
- const Parrot_SchedulerMessage_attributes * const
- core_struct = PARROT_SCHEDULERMESSAGE(SELF);
UNUSED(INTERP);
- return core_struct->id;
+ return PARROT_SCHEDULERMESSAGE(SELF)->id;
}
/*
@@ -131,9 +129,8 @@ Set the message ID.
*/
VTABLE void set_integer_native(INTVAL value) {
- Parrot_SchedulerMessage_attributes * const core_struct = PARROT_SCHEDULERMESSAGE(SELF);
UNUSED(INTERP);
- core_struct->id = value;
+ PARROT_SCHEDULERMESSAGE(SELF)->id = value;
}
@@ -148,10 +145,8 @@ Retrieve the message type.
*/
STRING * get_string() {
- const Parrot_SchedulerMessage_attributes * const core_struct =
- PARROT_SCHEDULERMESSAGE(SELF);
UNUSED(INTERP);
- return core_struct->type;
+ return PARROT_SCHEDULERMESSAGE(SELF)->type;
}
/*
@@ -165,9 +160,8 @@ Set the message type.
*/
VTABLE void set_string_native(STRING *value) {
- Parrot_SchedulerMessage_attributes * const core_struct = PARROT_SCHEDULERMESSAGE(SELF);
UNUSED(INTERP);
- core_struct->type = value;
+ PARROT_SCHEDULERMESSAGE(SELF)->type = value;
}
/*
Please sign in to comment.
Something went wrong with that request. Please try again.