External objects and finalization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

External objects and finalization

Schwab,Wilhelm K
Andreas,

You mentioned that all handles are cleared on startup.  Is there a convenient way to tap into that for executors for external objects?

Bill


Reply | Threaded
Open this post in threaded view
|

Re: External objects and finalization

Hans-Martin Mosner
Schwab,Wilhelm K schrieb:
> Andreas,
>
> You mentioned that all handles are cleared on startup.  Is there a convenient way to tap into that for executors for external objects?
>
> Bill
>
>  
This mechanism is there to break pointers from in-image objects to
non-existant external objects, so hooking executors for external objects
here would let the image die a horrible death.

What you probably need is a WeakRegistry holding finalizers for your
ExternalStructure subclass. But beware that for any external resource
which should be freed, there should be only one ExternalStructure
instance pointing to it, so that the structure is freed only when the
image has no pointers to it anymore.

Cheers,
Hans-Martin