develooper Front page | perl.perl5.porters | Postings from March 2007

SAVEDESTRUCTOR_X, but for previous scope level ?

Thread Next
Dean Arnold
March 2, 2007 16:11
SAVEDESTRUCTOR_X, but for previous scope level ?
Message ID:
I'm looking for a way to inject a destructor into the
next outer scope level ala SAVEDESTRUCTOR_X.

FYI: I've implemented a replacement for
threads::shared::lock(). I originally just cloned the
threads::shared code - including the SAVEDESTRUCTOR_X
call -, and made minor changes. But I've discovered that
threads::shared::lock() appears to be called via
an alternate route (PL_lockhook ?), rather than a regular
Perl sub call. Since my lock()
is called as a Perl sub, the registered destructor
is invoked immediately upon returning from the lock()
call, rather than at exit from the caller's scope.

I'm trying to maintain as much threads::shared API
similarity as possible, so it would be nice to avoid
an explicit unlock() call at the app level, using the same
scoping scheme as threads::shared::lock().

Any pointers much appreciated,
Dean Arnold

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About