A current implementation of this method

remove: oldObject ifAbsent: exceptionBlock
        "Remove oldObject as one of the receiver's elements."
        
        oldObject ifNil: [ ^nil ].
        ^(self protected: [ valueDictionary removeKey: oldObject ifAbsent: nil 
])
                ifNil: [ exceptionBlock value ]

simply removes a previously registered object from registry and voila.

Now lets get back to our discussion about multiple finalizers per
object and using them in weak subscriptions etc.

Suppose i am added a socket to weak registry,
and suppose i am added a weak subscription to it.

Now, if i do 'socket close' , it tells weak registry to remove it from list.
And what we'll have:
 - socket handle is closed
 - socket is wiped from weak registry
 - but weak subscription still listed somewhere in a list of subscriptions


My suggestion is, that upon #remove:,
a weak registry should notify all executors that object of interest
are no longer takes part in finalization scheme,
so they should not count on receiving #finalize eventually.

In other words:

remove: oldObject ifAbsent: exceptionBlock
        "Remove oldObject as one of the receiver's elements."
        
        oldObject ifNil: [ ^nil ].
        ^(self protected: [ | executor |
             executor := valueDictionary removeKey: oldObject ifAbsent: nil.
             executor discardFinalization.
         ])
        ifNil: [ exceptionBlock value ]


-- 
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to