--- a/WeakVDict.st Wed Jul 07 19:26:17 1999 +0200
+++ b/WeakVDict.st Wed Jul 07 20:17:00 1999 +0200
@@ -140,13 +140,45 @@
"Modified: 8.5.1996 / 14:54:09 / stefan"
! !
+!WeakValueDictionary methodsFor:'element disposal'!
+
+update:something with:aParameter from:changedObject
+ "an element (either key or value) died - clear out slots for
+ disposed keys."
+
+ |wasBlocked|
+
+ something == #ElementExpired ifTrue:[
+ "
+ have to block here - dispose may be done at a low priority
+ from the background finalizer. If new items are added by a
+ higher prio process, the dictionary might get corrupted otherwise
+ "
+ wasBlocked := OperatingSystem blockInterrupts.
+
+ valueArray
+ forAllDeadIndicesDo:[:idx | tally := tally - 1]
+ replacingCorpsesWith:nil.
+
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ]
+
+ "Created: 7.1.1997 / 16:59:30 / stefan"
+
+
+! !
+
!WeakValueDictionary methodsFor:'private'!
valueContainerOfSize:n
"return a container for values of size n.
use WeakArrays here."
- ^ WeakArray new:n.
+ |a|
+
+ a := WeakArray new:n.
+ a addDependent:self.
+ ^ a
"Created: 6.5.1996 / 14:47:37 / stefan"
! !
@@ -202,5 +234,5 @@
!WeakValueDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakVDict.st,v 1.9 1997-09-09 17:31:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakVDict.st,v 1.10 1999-07-07 18:17:00 cg Exp $'
! !
--- a/WeakValueDictionary.st Wed Jul 07 19:26:17 1999 +0200
+++ b/WeakValueDictionary.st Wed Jul 07 20:17:00 1999 +0200
@@ -140,13 +140,45 @@
"Modified: 8.5.1996 / 14:54:09 / stefan"
! !
+!WeakValueDictionary methodsFor:'element disposal'!
+
+update:something with:aParameter from:changedObject
+ "an element (either key or value) died - clear out slots for
+ disposed keys."
+
+ |wasBlocked|
+
+ something == #ElementExpired ifTrue:[
+ "
+ have to block here - dispose may be done at a low priority
+ from the background finalizer. If new items are added by a
+ higher prio process, the dictionary might get corrupted otherwise
+ "
+ wasBlocked := OperatingSystem blockInterrupts.
+
+ valueArray
+ forAllDeadIndicesDo:[:idx | tally := tally - 1]
+ replacingCorpsesWith:nil.
+
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ]
+
+ "Created: 7.1.1997 / 16:59:30 / stefan"
+
+
+! !
+
!WeakValueDictionary methodsFor:'private'!
valueContainerOfSize:n
"return a container for values of size n.
use WeakArrays here."
- ^ WeakArray new:n.
+ |a|
+
+ a := WeakArray new:n.
+ a addDependent:self.
+ ^ a
"Created: 6.5.1996 / 14:47:37 / stefan"
! !
@@ -202,5 +234,5 @@
!WeakValueDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WeakValueDictionary.st,v 1.9 1997-09-09 17:31:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WeakValueDictionary.st,v 1.10 1999-07-07 18:17:00 cg Exp $'
! !