The Trunk: Collections-ul.292.mcz

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

The Trunk: Collections-ul.292.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.292.mcz

==================== Summary ====================

Name: Collections-ul.292
Author: ul
Time: 5 February 2010, 4:27:13.702 am
UUID: 9ce9d2a0-0fad-7948-853c-788f56581c48
Ancestors: Collections-ul.291

- weak collection changes, part 2

=============== Diff against Collections-ul.291 ===============

Item was changed:
  ----- Method: WeakRegistry>>initialize: (in category 'initialize') -----
  initialize: n
  valueDictionary := WeakKeyDictionary new: n.
+ accessLock := Semaphore forMutualExclusion.
+ self installFinalizer.!
- accessLock := Semaphore forMutualExclusion.!

Item was added:
+ ----- Method: WeakRegistry>>installFinalizer (in category 'initialize') -----
+ installFinalizer
+
+ valueDictionary finalizer: [ :value |
+ (objectsToFinalize ifNil: [ objectsToFinalize := OrderedCollection new ]) add: value ]!

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 ]!
- accessLock := Semaphore forMutualExclusion.
- valueDictionary := valueDictionary copy.!

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."
+
  | finiObjects |
+ self protected: [
+ valueDictionary finalizeValues.
+ finiObjects := objectsToFinalize.
+ objectsToFinalize := nil ].
- finiObjects := nil.
- "First collect the objects."
- self protected: [
- valueDictionary associationsDo: [ :assoc |
- assoc key ifNil: [
- (finiObjects ifNil: [ finiObjects := IdentitySet new ])
- add: assoc value ] ].
- finiObjects ifNotNil: [ valueDictionary finalizeValues: finiObjects ] ].
- "Then do the finalization"
  finiObjects ifNil: [ ^self ].
+ finiObjects do: #finalize!
- finiObjects do: [ :each | each finalize ]!

Item was changed:
+ (PackageInfo named: 'Collections') postscript: 'WeakRegistry allInstancesDo: #installFinalizer'!
- (PackageInfo named: 'Collections') postscript: ''!