in reply to Re: Re: explicitly calling destructor
in thread explicitly calling destructor
Why is it better to have a clean_up() method that DESTROY() calls instead of just a DESTROY() method?You pretty much answered that question in your orriginal post...
I could call the DESTROY method explicity, which would release the lock. But then, I want to make certain that DESTROY is not called again, implicitly, if/when the object is really reclaimed, since the lock will have already been released, making it unsafe.
DESTROY is "magic", it's whole purpose for existing is to be implicitly called ... eventually. But you never know when, or in what order it will be called on for multiple objects -- And quite frankly, you never know what else perl might want to do it's calling your DESTROY method.
The simple fact that you think you need to explicitly call DESTROY at a specific time is a strong indication to me that you should rename that method. That's not what DESTROY is for.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: explicitly calling destructor
by mla (Beadle) on May 16, 2003 at 07:55 UTC | |
by LanceDeeply (Chaplain) on May 16, 2003 at 18:09 UTC | |
by edoc (Chaplain) on May 16, 2003 at 13:30 UTC | |
by diotalevi (Canon) on May 16, 2003 at 13:35 UTC | |
by edoc (Chaplain) on May 16, 2003 at 13:48 UTC |