On Tue, 16 Oct 2001, Dan Sugalski wrote: <snip> > An interpreter can get access to a shared PMC in another interpreter > only at interpreter clone time, or if explicitly passed in via an (as > yet undetermined) handoff method.
One thing I'd really like to be able to do in Parrot/Perl 6 is to be able to take groups of objects and pass them between threads (but not necessarily have them be shared) instead of having several individual mutex-protected objects. Maybe an extension on the compartments idea: Allow a parrot program to declare a new PMC container. Then when the program creates an object you can choose which compartment to stick it into. Then use the undetermined handoff method to move the whole compartment between threads (see below for hadnoff method idea). An access to a compartment that is not held by the current thread would be an error, as would be making references between compartments. Then all you need to implement this is one mutex per compartment that is held by whichever thread "owns" that compartment. You don't even ever have to unlock it if the thread never gives up ownership of the compartment. This would be great for daemons that need to be state-aware since they could store state information in a compartment and pass that compartment to whichever thread is handling it. Also, here's a handoff method idea: Make a (base?) type for object queues. These queues would be shared according to the rules you stated above. Define an enqueue and dequeue method that can move object compartments. Anyway, that's my idea. Now what the Perl 6 semantics would be for all this stuff I have no idea. :-) - D <[EMAIL PROTECTED]>