src/pmc/sharedref.pmc - Shared PMC Reference


The vtable functions for the SharedRef base class.

This class wraps locking around PMC access.

All methods not present below get a default body autogenerated inside Parrot::Pmc2c.

Currently all access is locked. When we have a non-copying GC allocator we can relax that a bit.

Methods ^

void init_pmc(PMC *init)

Initialize the shared reference.

TODO - If the PMC we refer to is an aggregate (or has properties) then:

A direct dereference of the SharedRef is currently not enabled so we shouldn't leak unshared PMCs into different threads.

void share()

We already share, so just ignore.

void mark()

Marks the reference as live.

void set_pmc(PMC *other)

Sets the referenced PMC to *other.

PMC *get_pmc()

Catch dereferencing. This would unshare the referred PMC.

void destroy()

Destroys the referred object and itself. This probably needs destroy ordering or at least a detection if the referred PMC is already destroyed.


Initial revision by leo 2004.01.14.