On Wed, Aug 17, 2005 at 05:06:55 -0000, David Formosa (aka ? the Platypus) wrote:
> This should be changed, timelyness will not prevent deadlock. However
> it will prevent resource starvation aka livelock.
What I meant is deadlock due to resource starvation:
my $semaphore = Sempahore.new(5);
my $object = Moose.new($semaphore); # takes as much as it likes,
# destructor releases semaphore
...
undefined($object);
my $other = Moose.new($semaphore); # this might or might not
# hang till the GC kicks in
BTW, we need an interface like:
class Resource { # a mutex of sorts
has enum<<Locked Free>> $:state = Free;
method claim ($claimee = $?CALLER::SELF) : atomic {
$:state = Locked;
$claimee but GC::timely GC::append_finalize({ $:state =
Free });
}
}
then an object can say:
class Object {
method use_this ($resource){
$resource.claim;
}
}
And without worrying about adding a finalizer of it's own (the added
finalizers don't conflict either, and due to post order happen
before the class's finalizer).
> I'm not sure that replacing the GC is going to be easy, I expect
> thats going to involve heavy magic.
If the runtime has an interface where it allows you to replace the
GC with some pluggable GCs it supports, then why not?
--
() Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker &
/\ kung foo master: /me does not drink tibetian laxative tea: neeyah!
pgpekal6UsWNw.pgp
Description: PGP signature
