On Thu, 23 Oct 2003, Mike Pomraning wrote:

> [....] suggestions on how I might determine which DESTROY [of a shared,
> blessed ref] is the very last one?

Sorry to reply to my own post, but here's how I've attempted to identify the
last DESTROY of a shared object:

  sub DESTROY {
    return unless threads::shared::_refcnt($_[0]) == 1;
    # if we're here, the shared object is going away for good.
    # time to release system resources, call XS deallocators, etc.
    }
  }

The only other approach I can think of is to do (ser|ted)ious inventorying via
CLONE, DESTROY and constructors, or a wrapped bless.  (I did see the
"[CAUTION] Thread-saving modules" not-a-bug thread from Jul 2002 before my
previous post, but this is not quite the same.)

Multiple destruction of non-shared objects makes sense to me, as each becomes
a thread-local copy.  Multiple destruction of shared objects, however, does
not (though I think I understand the mechanics of why it happens).  Am I
looking at this issue the wrong way?

Regards,
Mike
-- 
Michael J. Pomraning
[EMAIL PROTECTED]
http://pilcrow.madison.wi.us

Reply via email to