parrotcode: The concurrency scheduler | |
Contents | PMCs |
src/pmc/scheduler.pmc - The concurrency scheduler
Implements the core concurrency scheduler.
void init()
void init_pmc(PMC *data)
Hash
PMC with any or all of the keys:id
Integer
representing the unique identifier for this scheduler. void init_pmc(PMC *data) {
PMC *elem;
Parrot_Scheduler *core_struct;
if (! VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Hash")))
real_exception(INTERP, NULL, INVALID_OPERATION,
"Task initializer must be a Hash");
core_struct = mem_allocate_zeroed_typed(Parrot_Scheduler);
/* Set flags for custom DOD mark and destroy. */
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))
core_struct->id = VTABLE_get_integer(INTERP, elem);
else
core_struct->id = 0;
core_struct->max_tid = 0;
core_struct->task_list = pmc_new(interp, enum_class_Hash);
core_struct->task_index = pmc_new(interp, enum_class_ResizableIntegerArray);
core_struct->handlers = pmc_new(interp, enum_class_ResizablePMCArray);
core_struct->interp = INTERP;
}
void push_pmc(PMC *value)
PMC *pop_pmc()
INTVAL get_integer()
void delete_keyed_int(INTVAL key)
PMC *share_ro()
void destroy()
void mark()
void visit(visit_info *info)
*info
is the visit info, (see include/parrot/pmc_freeze.h).void freeze(visit_info *info)
void thaw(visit_info *info)
void thawfinish(visit_info *info)
PCCMETHOD add_handler(PMC *handler)
PCCMETHOD find_handler(PMC *task)
|