Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.313.mcz==================== Summary ====================
Name: Collections-ul.313
Author: ul
Time: 23 February 2010, 4:49:31.952 pm
UUID: 4f43900b-93d5-7144-a11a-84da97796c6e
Ancestors: Collections-ul.312
Finalization enhancement (part 2)
- cleanup
=============== Diff against Collections-ul.312 ===============
Item was changed:
Collection subclass: #WeakRegistry
+ instanceVariableNames: 'valueDictionary accessLock'
- instanceVariableNames: 'valueDictionary accessLock objectsToFinalize'
classVariableNames: 'Default'
poolDictionaries: ''
category: 'Collections-Weak'!
!WeakRegistry commentStamp: '<historical>' prior: 0!
I am a registry for objects needing finalization. When an object is added the object as well as its executor is stored. When the object is garbage collected, the executor can take the appropriate action for any resources associated with the object.
See also:
Object executor
Object actAsExecutor
Object finalize
!
Item was changed:
----- Method: WeakRegistry>>postCopy (in category 'copying') -----
postCopy
self protected: [ "Uses the original accessLock"
accessLock := Semaphore forMutualExclusion.
valueDictionary := valueDictionary copy.
- objectsToFinalize := objectsToFinalize copy.
self installFinalizer ]!
Item was changed:
----- Method: WeakRegistry>>finalizeValues (in category 'finalization') -----
finalizeValues
"Some of our elements may have gone away. Look for those and activate the associated executors."
+ self protected: [ valueDictionary finalizeValues ]!
- | finiObjects |
- self protected: [
- valueDictionary finalizeValues.
- finiObjects := objectsToFinalize.
- objectsToFinalize := nil ].
- finiObjects ifNil: [ ^self ].
- finiObjects do: #finalize!
Item was changed:
+ (PackageInfo named: 'Collections') postscript: ''!
- (PackageInfo named: 'Collections') postscript: 'WeakRegistry allInstancesDo: #installFinalizer.
- Smalltalk garbageCollect.
- WeakRegistry allInstancesDo: #finalizeValues'!