NAME ^

src/pmc/schedulermessage.pmc - The concurrency scheduler

DESCRIPTION ^

Implements a message passed between concurrency schedulers.

Vtable Functions ^

void init()

Initialize a concurrency scheduler message object.

void init_pmc(PMC *data)

Initializes a new SchedulerMessage with a Hash PMC with any or all of the keys:

id

An Integer representing the unique identifier for this scheduler message.

type

A String representing the unique type for this scheduler message.

data

An PMC representing the data passed in this scheduler message.

*/

    void init_pmc(PMC *data) {
        PMC              *elem;
        Parrot_SchedulerMessage *core_struct;

        if (! VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Hash")))
            real_exception(INTERP, NULL, INVALID_OPERATION,
                "message initializer must be a Hash");

        SELF.init();
        core_struct = PARROT_SCHEDULERMESSAGE(SELF);

        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);

        elem = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "type"));
        if (! PMC_IS_NULL(elem))
            core_struct->type = VTABLE_get_string(INTERP, elem);

        elem = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "data"));
        if (! PMC_IS_NULL(elem))
            core_struct->data = elem;
    }
/*

INTVAL get_integer()

Retrieve the message ID.

void set_integer_native(INTVAL value)

Set the message ID.

STRING *get_string()

Retrieve the message type.

void set_string_native(STRING *value)

Set the message type.

PMC *share_ro()

Set this PMC as shared.

void destroy()

Free the scheduler's underlying struct.

void mark()

Mark any referenced strings and PMCs.

void visit(visit_info *info)

This is used by freeze/thaw to visit the contents of the scheduler message.

*info is the visit info, (see include/parrot/pmc_freeze.h).

void freeze(visit_info *info)

Used to archive the scheduler message.

void thaw(visit_info *info)

Used to unarchive the scheduler message.

SEE ALSO ^

docs/pdds/pdd25_concurrency.pod.


parrot