NAME

src/pmc/scheduler.pmc - The concurrency scheduler

DESCRIPTION

Implements the core concurrency scheduler.

Vtable Functions

void init()
Initializes a concurrency scheduler object.
void init_pmc(PMC *data)
Initializes a new Scheduler with a Hash PMC with any or all of the keys:
id
An Integer representing the unique identifier for this scheduler.
void push_pmc(PMC *value)
Inserts a task into the task list, giving it a task ID one higher than the current maximum, and a birthtime of the current time.
PMC *pop_pmc()
Retrieves the next task from the task list. If the task index is invalid, recalculates it before retrieving the next task.
INTVAL get_integer()
Retrieves the number of pending tasks in the scheduler's task list.
void delete_keyed_int(INTVAL key)
Removes the task with the given task ID from the task list.
void destroy()
Frees the scheduler's underlying struct.
void mark()
Marks any referenced strings and PMCs as live.
void visit(PMC *info)
Visits the contents of the scheduler (used by freeze/thaw).*info is the visit info (see include/parrot/pmc_freeze.h).
void freeze(PMC *info)
Archives the scheduler.
void thaw(PMC *info)
Unarchives the scheduler.
void thawfinish(PMC *info)
Finishes thawing the scheduler.

Methods

METHOD add_handler(PMC *handler)
Adds a handler to the scheduler.
METHOD delete_handler(STRING *type :optional, INTVAL have_type :opt_flag)
Deletes a handler from the scheduler.
METHOD find_handler(PMC *task)
Searchs for a handler for the given task. If no handler is found, returns PMCNULL.
METHOD count_handlers(STRING *type :optional, INTVAL have_type :opt_flag)
Returns the number of handlers currently held by the scheduler. If a type argument is passed, only counts handlers of that type (event, exception). If no type argument is passed, counts all handlers.

SEE ALSO

docs/pdds/pdd25_concurrency.pod.