NAME

src/pmc/alarm.pmc - Alarm PMC

SYNOPSIS

    .include 'alarm.pasm'

    new P0, 'Alarm'
    set P0[.PARROT_ALARM_TIME], N_time   # A FLOATVAL
    set P0[.PARROT_ALARM_SUB],  P_sub    # set handler sub PMC
    invoke P0                            # schedule the alarm

DESCRIPTION

Sometime after N_time, P_sub will be called exactly once. Notice that due to various factors, the alarm is not guaranteed to execute at N_time, but only a short time thereafter. The length of "a short time" is very system dependent.

Functions

void init()
Initializes the alarm.
PMC *clone()
Create a copy of the alarm.
PMC *get_pmc_keyed_int(INTVAL key)
Returns the PMC associated with key.
FLOATVAL get_number_keyed_int(INTVAL key)
Returns the number associated with key.
FLOATVAL get_number()
Having the alarm numify to the time is convienient for sorting.
void set_pmc_keyed_int(INTVAL key, PMC *value)
Sets the PMC associated with key to *value.
opcode_t *invoke(void *next)
Schedules the alarm and adds it to the alarm queue.
void set_number_keyed_int(INTVAL key, FLOATVAL value)
Sets the floating-point value associated with key to value.