Use dependent mechamism of WeakArray instead of #watcher.
Remove deprecated watcher stuff.
--- a/ProcSched.st Wed Jan 08 20:07:09 1997 +0100
+++ b/ProcSched.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:38' !
+
Object subclass:#ProcessorScheduler
instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess
currentPriority readFdArray readSemaphoreArray readCheckArray
@@ -184,7 +186,7 @@
!ProcessorScheduler class methodsFor:'instance release'!
-informDispose
+update:something with:aParameter from:changedObject
"some Process has been garbage collected
- terminate the underlying thread.
Usually this does not happen; instead, the process terminates itself
@@ -192,22 +194,26 @@
|id sz "{ Class: SmallInteger }"|
- sz := KnownProcessIds size.
- 1 to:sz do:[:index |
- "/ (KnownProcesses at:index) isNil ifTrue:[
- (KnownProcesses at:index) == 0 ifTrue:[
- id := KnownProcessIds at:index.
- id notNil ifTrue:[
- 'PROCESSOR: terminating thread ' errorPrint.
- id errorPrint.
- ' (no longer refd)' errorPrintNL.
-
- self threadDestroy:id.
- KnownProcessIds at:index put:nil.
- ].
- KnownProcesses at:index put:nil.
- ]
+ something == #ElementExpired ifTrue:[
+ sz := KnownProcessIds size.
+ 1 to:sz do:[:index |
+ "/ (KnownProcesses at:index) isNil ifTrue:[
+ (KnownProcesses at:index) == 0 ifTrue:[
+ id := KnownProcessIds at:index.
+ id notNil ifTrue:[
+ 'PROCESSOR: terminating thread ' errorPrint.
+ id errorPrint.
+ ' (no longer refd)' errorPrintNL.
+
+ self threadDestroy:id.
+ KnownProcessIds at:index put:nil.
+ ].
+ KnownProcesses at:index put:nil.
+ ]
+ ]
]
+
+ "Created: 7.1.1997 / 16:45:42 / stefan"
! !
!ProcessorScheduler class methodsFor:'primitive process primitives'!
@@ -931,17 +937,17 @@
index := 1.
sz := KnownProcessIds size.
[index <= sz] whileTrue:[
- (KnownProcesses at:index) isNil ifTrue:[
- oldId := KnownProcessIds at:index.
- oldId notNil ifTrue:[
- self class threadDestroy:oldId.
- ].
- KnownProcesses at:index put:aProcess.
- KnownProcessIds at:index put:aProcess id.
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
- ^ self
- ].
- index := index + 1
+ (KnownProcesses at:index) isNil ifTrue:[
+ oldId := KnownProcessIds at:index.
+ oldId notNil ifTrue:[
+ self class threadDestroy:oldId.
+ ].
+ KnownProcesses at:index put:aProcess.
+ KnownProcessIds at:index put:aProcess id.
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ^ self
+ ].
+ index := index + 1
].
KnownProcessIds grow:index.
@@ -949,13 +955,15 @@
oldSize := KnownProcesses size.
(index > oldSize) ifTrue:[
- newShadow := WeakArray new:(oldSize * 2).
- newShadow watcher:self class.
- newShadow replaceFrom:1 with:KnownProcesses.
- KnownProcesses := newShadow
+ newShadow := WeakArray new:(oldSize * 2).
+ newShadow addDependent:self class.
+ newShadow replaceFrom:1 with:KnownProcesses.
+ KnownProcesses := newShadow
].
KnownProcesses at:index put:aProcess.
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+ "Modified: 7.1.1997 / 16:48:39 / stefan"
!
unRemember:aProcess
@@ -981,9 +989,9 @@
p l|
KnownProcesses isNil ifTrue:[
- KnownProcesses := WeakArray new:30.
- KnownProcesses watcher:self class.
- KnownProcessIds := OrderedCollection new.
+ KnownProcesses := WeakArray new:30.
+ KnownProcesses addDependent:self class.
+ KnownProcessIds := OrderedCollection new.
].
"
@@ -1036,8 +1044,8 @@
ObjectMemory timerInterruptHandler:self.
ObjectMemory childSignalInterruptHandler:self.
- "Modified: 12.4.1996 / 10:12:56 / stefan"
"Modified: 29.7.1996 / 12:10:59 / cg"
+ "Modified: 7.1.1997 / 16:48:26 / stefan"
!
reinitialize
@@ -2300,6 +2308,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.101 1996-11-15 10:47:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/ProcSched.st,v 1.102 1997-01-08 19:42:10 stefan Exp $'
! !
ProcessorScheduler initialize!
--- a/ProcessorScheduler.st Wed Jan 08 20:07:09 1997 +0100
+++ b/ProcessorScheduler.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:38' !
+
Object subclass:#ProcessorScheduler
instanceVariableNames:'quiescentProcessLists scheduler zombie activeProcess
currentPriority readFdArray readSemaphoreArray readCheckArray
@@ -184,7 +186,7 @@
!ProcessorScheduler class methodsFor:'instance release'!
-informDispose
+update:something with:aParameter from:changedObject
"some Process has been garbage collected
- terminate the underlying thread.
Usually this does not happen; instead, the process terminates itself
@@ -192,22 +194,26 @@
|id sz "{ Class: SmallInteger }"|
- sz := KnownProcessIds size.
- 1 to:sz do:[:index |
- "/ (KnownProcesses at:index) isNil ifTrue:[
- (KnownProcesses at:index) == 0 ifTrue:[
- id := KnownProcessIds at:index.
- id notNil ifTrue:[
- 'PROCESSOR: terminating thread ' errorPrint.
- id errorPrint.
- ' (no longer refd)' errorPrintNL.
-
- self threadDestroy:id.
- KnownProcessIds at:index put:nil.
- ].
- KnownProcesses at:index put:nil.
- ]
+ something == #ElementExpired ifTrue:[
+ sz := KnownProcessIds size.
+ 1 to:sz do:[:index |
+ "/ (KnownProcesses at:index) isNil ifTrue:[
+ (KnownProcesses at:index) == 0 ifTrue:[
+ id := KnownProcessIds at:index.
+ id notNil ifTrue:[
+ 'PROCESSOR: terminating thread ' errorPrint.
+ id errorPrint.
+ ' (no longer refd)' errorPrintNL.
+
+ self threadDestroy:id.
+ KnownProcessIds at:index put:nil.
+ ].
+ KnownProcesses at:index put:nil.
+ ]
+ ]
]
+
+ "Created: 7.1.1997 / 16:45:42 / stefan"
! !
!ProcessorScheduler class methodsFor:'primitive process primitives'!
@@ -931,17 +937,17 @@
index := 1.
sz := KnownProcessIds size.
[index <= sz] whileTrue:[
- (KnownProcesses at:index) isNil ifTrue:[
- oldId := KnownProcessIds at:index.
- oldId notNil ifTrue:[
- self class threadDestroy:oldId.
- ].
- KnownProcesses at:index put:aProcess.
- KnownProcessIds at:index put:aProcess id.
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
- ^ self
- ].
- index := index + 1
+ (KnownProcesses at:index) isNil ifTrue:[
+ oldId := KnownProcessIds at:index.
+ oldId notNil ifTrue:[
+ self class threadDestroy:oldId.
+ ].
+ KnownProcesses at:index put:aProcess.
+ KnownProcessIds at:index put:aProcess id.
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ^ self
+ ].
+ index := index + 1
].
KnownProcessIds grow:index.
@@ -949,13 +955,15 @@
oldSize := KnownProcesses size.
(index > oldSize) ifTrue:[
- newShadow := WeakArray new:(oldSize * 2).
- newShadow watcher:self class.
- newShadow replaceFrom:1 with:KnownProcesses.
- KnownProcesses := newShadow
+ newShadow := WeakArray new:(oldSize * 2).
+ newShadow addDependent:self class.
+ newShadow replaceFrom:1 with:KnownProcesses.
+ KnownProcesses := newShadow
].
KnownProcesses at:index put:aProcess.
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
+ "Modified: 7.1.1997 / 16:48:39 / stefan"
!
unRemember:aProcess
@@ -981,9 +989,9 @@
p l|
KnownProcesses isNil ifTrue:[
- KnownProcesses := WeakArray new:30.
- KnownProcesses watcher:self class.
- KnownProcessIds := OrderedCollection new.
+ KnownProcesses := WeakArray new:30.
+ KnownProcesses addDependent:self class.
+ KnownProcessIds := OrderedCollection new.
].
"
@@ -1036,8 +1044,8 @@
ObjectMemory timerInterruptHandler:self.
ObjectMemory childSignalInterruptHandler:self.
- "Modified: 12.4.1996 / 10:12:56 / stefan"
"Modified: 29.7.1996 / 12:10:59 / cg"
+ "Modified: 7.1.1997 / 16:48:26 / stefan"
!
reinitialize
@@ -2300,6 +2308,6 @@
!ProcessorScheduler class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.101 1996-11-15 10:47:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ProcessorScheduler.st,v 1.102 1997-01-08 19:42:10 stefan Exp $'
! !
ProcessorScheduler initialize!
--- a/Registry.st Wed Jan 08 20:07:09 1997 +0100
+++ b/Registry.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 8-jan-1997 at 14:05:07' !
+
Object subclass:#Registry
instanceVariableNames:'registeredObjects handleArray cleanState'
classVariableNames:''
@@ -96,7 +98,7 @@
wasBlocked := OperatingSystem blockInterrupts.
registeredObjects size == 0 "isNil" ifTrue:[
registeredObjects := WeakArray new:10.
- registeredObjects watcher:self.
+ registeredObjects addDependent:self.
handleArray := Array basicNew:10.
registeredObjects at:1 put:anObject.
handleArray at:1 put:aHandle.
@@ -148,7 +150,7 @@
newColl := WeakArray new:(size * 2).
newColl replaceFrom:1 to:size with:registeredObjects.
registeredObjects := newColl.
- registeredObjects watcher:self.
+ registeredObjects addDependent:self.
registeredObjects at:index put:anObject.
newPhantoms := Array basicNew:(size * 2).
@@ -159,6 +161,7 @@
wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
"Modified: 22.6.1996 / 14:33:08 / cg"
+ "Modified: 7.1.1997 / 16:56:03 / stefan"
!
registerChange:anObject
@@ -204,34 +207,37 @@
!Registry methodsFor:'dispose handling'!
-informDispose
+informDispose:someHandle
+ someHandle disposed
+!
+
+update:something with:aParameter from:changedObject
"an instance has been destroyed - look which one it was"
- |phantom
- dstIdx "{ Class: SmallInteger }"
- sz "{ Class: SmallInteger }"
- tally "{ Class: SmallInteger }"
- newObjects newHandles|
+ something == #ElementExpired ifTrue:[
+ |phantom
+ dstIdx "{ Class: SmallInteger }"
+ sz "{ Class: SmallInteger }"
+ tally "{ Class: SmallInteger }"
+ newObjects newHandles|
- sz := handleArray size.
- tally := 0.
+ sz := handleArray size.
+ tally := 0.
- 1 to:sz do:[:index |
-"/ (registeredObjects at:index) isNil ifTrue:[
- (registeredObjects at:index) == 0 ifTrue:[
- registeredObjects at:index put:nil.
- phantom := handleArray at:index.
- phantom notNil ifTrue:[
- handleArray at:index put:nil.
- self informDispose:phantom
+ 1 to:sz do:[:index |
+ (registeredObjects at:index) == 0 ifTrue:[
+ registeredObjects at:index put:nil.
+ phantom := handleArray at:index.
+ phantom notNil ifTrue:[
+ handleArray at:index put:nil.
+ self informDispose:phantom
+ ]
+ ] ifFalse:[
+ tally := tally + 1
]
- ] ifFalse:[
- tally := tally + 1
- ]
- ].
+ ].
- sz > 50 ifTrue:[
- tally < (sz // 2) ifTrue:[
+ (sz > 50 and:[tally < (sz // 2)]) ifTrue:[
"/ shrink
newObjects := WeakArray new:(tally * 3 // 2).
newHandles := Array new:(newObjects size).
@@ -245,15 +251,22 @@
]
].
- newObjects watcher:self.
+ newObjects addDependent:self.
registeredObjects := newObjects.
handleArray := newHandles.
]
- ].
-!
+ ] ifFalse:[something == #earlyRestart ifTrue:[
+ handleArray notNil ifTrue:[
+ handleArray atAllPut:nil
+ ]
+ ]].
-informDispose:someHandle
- someHandle disposed
+"/ something == #returnFromSnapshot ifTrue:[
+"/ cleanState := true
+"/ ]
+
+ "Created: 15.6.1996 / 15:24:41 / cg"
+ "Modified: 8.1.1997 / 14:05:02 / stefan"
! !
!Registry methodsFor:'enumerating'!
@@ -270,24 +283,8 @@
]
! !
-!Registry methodsFor:'restart handling'!
-
-update:something with:aParameter from:changedObject
- something == #earlyRestart ifTrue:[
- handleArray notNil ifTrue:[
- handleArray atAllPut:nil
- ]
- ].
-
-"/ something == #returnFromSnapshot ifTrue:[
-"/ cleanState := true
-"/ ]
-
- "Created: 15.6.1996 / 15:24:41 / cg"
-! !
-
!Registry class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Registry.st,v 1.32 1996-11-11 11:36:28 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Registry.st,v 1.33 1997-01-08 19:42:13 stefan Exp $'
! !
--- a/WeakArr.st Wed Jan 08 20:07:09 1997 +0100
+++ b/WeakArr.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,8 +10,10 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:10' !
+
Array subclass:#WeakArray
- instanceVariableNames:'watcher dependents'
+ instanceVariableNames:'dependents'
classVariableNames:'RegistrationFailedSignal AlreadyInitialized'
poolDictionaries:''
category:'Collections-Arrayed'
@@ -67,17 +69,7 @@
Also, as a side effect, it is possible to delay finalization by blocking
interrupts.
- Notice, that there are currently two mechanisms by which a weakArray notifies
- its dependents: via normal dependency notfications and/or by sending an
- explicit message to a watcher object, which is found in an instvar of the
- WeakArray.
-
- Having two mechanisms here (i.e. watcher & dependent) is a historic leftover;
- I dont know, which of the two mechanisms will survive in the long run -
- I started with the watcher, but now switch to dependencies since they seem
- to offer more flexibility.
- You should NOT use the watcher mechanism; be prepared, that the watcher
- mechanism may vanish in the future (i.e. use dependents for your applications).
+ A weakArray notifies its dependents via normal dependency notfications.
NOTICE:
WeakArray handling adds some overhead to the VM
@@ -92,9 +84,6 @@
[instance variables:]
- watcher if non-nil, gets informed via #informDispose
- that the weakArray has lost pointers.
-
dependents get informed via #change notifiction
that the weakArray has lost pointers.
Having the dependents here is an optimization.
@@ -271,22 +260,6 @@
"set the dependents of the receiver"
dependents := aCollection
-!
-
-watcher
- "return the watcher of the receiver.
- The watcher-stuff is a leftover from an old implementation
- and will vanish soon"
-
- ^ watcher
-!
-
-watcher:anObject
- "set the watcher of the receiver.
- The watcher-stuff is a leftover from an old implementation
- and will vanish soon"
-
- watcher := anObject
! !
!WeakArray methodsFor:'copying'!
@@ -641,22 +614,20 @@
!WeakArray methodsFor:'notification'!
lostPointer
- "I lost a pointer; tell watcher and/or dependents.
+ "I lost a pointer; tell dependents.
This is sent from the finalization code in ObjectMemory."
- watcher notNil ifTrue:[
- watcher informDispose
- ].
dependents notNil ifTrue:[
self changed:#ElementExpired with:nil.
].
"Modified: 18.10.1996 / 21:28:10 / cg"
+ "Modified: 7.1.1997 / 17:22:52 / stefan"
! !
!WeakArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakArr.st,v 1.36 1996-11-06 12:17:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakArr.st,v 1.37 1997-01-08 19:42:14 stefan Exp $'
! !
WeakArray initialize!
--- a/WeakArray.st Wed Jan 08 20:07:09 1997 +0100
+++ b/WeakArray.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,8 +10,10 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:10' !
+
Array subclass:#WeakArray
- instanceVariableNames:'watcher dependents'
+ instanceVariableNames:'dependents'
classVariableNames:'RegistrationFailedSignal AlreadyInitialized'
poolDictionaries:''
category:'Collections-Arrayed'
@@ -67,17 +69,7 @@
Also, as a side effect, it is possible to delay finalization by blocking
interrupts.
- Notice, that there are currently two mechanisms by which a weakArray notifies
- its dependents: via normal dependency notfications and/or by sending an
- explicit message to a watcher object, which is found in an instvar of the
- WeakArray.
-
- Having two mechanisms here (i.e. watcher & dependent) is a historic leftover;
- I dont know, which of the two mechanisms will survive in the long run -
- I started with the watcher, but now switch to dependencies since they seem
- to offer more flexibility.
- You should NOT use the watcher mechanism; be prepared, that the watcher
- mechanism may vanish in the future (i.e. use dependents for your applications).
+ A weakArray notifies its dependents via normal dependency notfications.
NOTICE:
WeakArray handling adds some overhead to the VM
@@ -92,9 +84,6 @@
[instance variables:]
- watcher if non-nil, gets informed via #informDispose
- that the weakArray has lost pointers.
-
dependents get informed via #change notifiction
that the weakArray has lost pointers.
Having the dependents here is an optimization.
@@ -271,22 +260,6 @@
"set the dependents of the receiver"
dependents := aCollection
-!
-
-watcher
- "return the watcher of the receiver.
- The watcher-stuff is a leftover from an old implementation
- and will vanish soon"
-
- ^ watcher
-!
-
-watcher:anObject
- "set the watcher of the receiver.
- The watcher-stuff is a leftover from an old implementation
- and will vanish soon"
-
- watcher := anObject
! !
!WeakArray methodsFor:'copying'!
@@ -641,22 +614,20 @@
!WeakArray methodsFor:'notification'!
lostPointer
- "I lost a pointer; tell watcher and/or dependents.
+ "I lost a pointer; tell dependents.
This is sent from the finalization code in ObjectMemory."
- watcher notNil ifTrue:[
- watcher informDispose
- ].
dependents notNil ifTrue:[
self changed:#ElementExpired with:nil.
].
"Modified: 18.10.1996 / 21:28:10 / cg"
+ "Modified: 7.1.1997 / 17:22:52 / stefan"
! !
!WeakArray class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WeakArray.st,v 1.36 1996-11-06 12:17:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WeakArray.st,v 1.37 1997-01-08 19:42:14 stefan Exp $'
! !
WeakArray initialize!
--- a/WeakIdDict.st Wed Jan 08 20:07:09 1997 +0100
+++ b/WeakIdDict.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:20' !
+
IdentityDictionary subclass:#WeakIdentityDictionary
instanceVariableNames:''
classVariableNames:''
@@ -105,30 +107,34 @@
!WeakIdentityDictionary methodsFor:'element disposal'!
-informDispose
+update:something with:aParameter from:changedObject
"an element (either key or value) died - rehash"
- | wasBlocked |
+ |wasBlocked|
- "
- have to block here - dispose may be done at a low priority
- from the background finalizer. If new views are opened in
- the foreground, the dependency dictionary may get corrupted
- otherwise
- "
- wasBlocked := OperatingSystem blockInterrupts.
+ something == #ElementExpired ifTrue:[
+ "
+ have to block here - dispose may be done at a low priority
+ from the background finalizer. If new views are opened in
+ the foreground, the dependency dictionary may get corrupted
+ otherwise
+ "
+ wasBlocked := OperatingSystem blockInterrupts.
- keyArray
- forAllDeadIndicesDo:[:idx |
- (valueArray at:idx) notNil ifTrue:[
- keyArray basicAt:idx put:DeletedEntry.
- valueArray basicAt:idx put:nil.
- tally := tally - 1.
+ keyArray
+ forAllDeadIndicesDo:[:idx |
+ (valueArray at:idx) notNil ifTrue:[
+ keyArray basicAt:idx put:DeletedEntry.
+ valueArray basicAt:idx put:nil.
+ tally := tally - 1.
+ ]
]
- ]
- replacingCorpsesWith:DeletedEntry.
+ replacingCorpsesWith:DeletedEntry.
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ]
+
+ "Created: 7.1.1997 / 16:59:30 / stefan"
! !
!WeakIdentityDictionary methodsFor:'private'!
@@ -140,12 +146,14 @@
|w|
w := WeakArray new:n.
- w watcher:self.
+ w addDependent:self.
^ w
+
+ "Modified: 7.1.1997 / 17:01:15 / stefan"
! !
!WeakIdentityDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakIdDict.st,v 1.22 1997-01-02 18:10:12 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakIdDict.st,v 1.23 1997-01-08 19:42:15 stefan Exp $'
! !
--- a/WeakIdSet.st Wed Jan 08 20:07:09 1997 +0100
+++ b/WeakIdSet.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:23' !
+
IdentitySet subclass:#WeakIdentitySet
instanceVariableNames:''
classVariableNames:''
@@ -118,20 +120,24 @@
!WeakIdentitySet methodsFor:'element disposal'!
-informDispose
+update:something with:aParameter from:changedObject
"an element died - must rehash"
|wasBlocked|
- "
- must block interrupts here - finalization
- may be done at low prio in the background
- finalizer, we do not want to be interrupted
- while rehashing
- "
- wasBlocked := OperatingSystem blockInterrupts.
- keyArray forAllDeadIndicesDo:[:idx | tally := tally - 1] replacingCorpsesWith:DeletedEntry.
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ something == #ElementExpired ifTrue:[
+ "
+ must block interrupts here - finalization
+ may be done at low prio in the background
+ finalizer, we do not want to be interrupted
+ while rehashing
+ "
+ wasBlocked := OperatingSystem blockInterrupts.
+ keyArray forAllDeadIndicesDo:[:idx | tally := tally - 1] replacingCorpsesWith:DeletedEntry.
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ].
+
+ "Created: 7.1.1997 / 17:00:33 / stefan"
! !
!WeakIdentitySet methodsFor:'enumerating'!
@@ -169,12 +175,14 @@
|w|
w := WeakArray new:n.
- w watcher:self.
+ w addDependent:self.
^ w
+
+ "Modified: 7.1.1997 / 17:01:28 / stefan"
! !
!WeakIdentitySet class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakIdSet.st,v 1.20 1997-01-02 18:09:36 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/WeakIdSet.st,v 1.21 1997-01-08 19:42:17 stefan Exp $'
! !
--- a/WeakIdentityDictionary.st Wed Jan 08 20:07:09 1997 +0100
+++ b/WeakIdentityDictionary.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:20' !
+
IdentityDictionary subclass:#WeakIdentityDictionary
instanceVariableNames:''
classVariableNames:''
@@ -105,30 +107,34 @@
!WeakIdentityDictionary methodsFor:'element disposal'!
-informDispose
+update:something with:aParameter from:changedObject
"an element (either key or value) died - rehash"
- | wasBlocked |
+ |wasBlocked|
- "
- have to block here - dispose may be done at a low priority
- from the background finalizer. If new views are opened in
- the foreground, the dependency dictionary may get corrupted
- otherwise
- "
- wasBlocked := OperatingSystem blockInterrupts.
+ something == #ElementExpired ifTrue:[
+ "
+ have to block here - dispose may be done at a low priority
+ from the background finalizer. If new views are opened in
+ the foreground, the dependency dictionary may get corrupted
+ otherwise
+ "
+ wasBlocked := OperatingSystem blockInterrupts.
- keyArray
- forAllDeadIndicesDo:[:idx |
- (valueArray at:idx) notNil ifTrue:[
- keyArray basicAt:idx put:DeletedEntry.
- valueArray basicAt:idx put:nil.
- tally := tally - 1.
+ keyArray
+ forAllDeadIndicesDo:[:idx |
+ (valueArray at:idx) notNil ifTrue:[
+ keyArray basicAt:idx put:DeletedEntry.
+ valueArray basicAt:idx put:nil.
+ tally := tally - 1.
+ ]
]
- ]
- replacingCorpsesWith:DeletedEntry.
+ replacingCorpsesWith:DeletedEntry.
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ]
+
+ "Created: 7.1.1997 / 16:59:30 / stefan"
! !
!WeakIdentityDictionary methodsFor:'private'!
@@ -140,12 +146,14 @@
|w|
w := WeakArray new:n.
- w watcher:self.
+ w addDependent:self.
^ w
+
+ "Modified: 7.1.1997 / 17:01:15 / stefan"
! !
!WeakIdentityDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentityDictionary.st,v 1.22 1997-01-02 18:10:12 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentityDictionary.st,v 1.23 1997-01-08 19:42:15 stefan Exp $'
! !
--- a/WeakIdentitySet.st Wed Jan 08 20:07:09 1997 +0100
+++ b/WeakIdentitySet.st Wed Jan 08 20:42:17 1997 +0100
@@ -10,6 +10,8 @@
hereby transferred.
"
+'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:23' !
+
IdentitySet subclass:#WeakIdentitySet
instanceVariableNames:''
classVariableNames:''
@@ -118,20 +120,24 @@
!WeakIdentitySet methodsFor:'element disposal'!
-informDispose
+update:something with:aParameter from:changedObject
"an element died - must rehash"
|wasBlocked|
- "
- must block interrupts here - finalization
- may be done at low prio in the background
- finalizer, we do not want to be interrupted
- while rehashing
- "
- wasBlocked := OperatingSystem blockInterrupts.
- keyArray forAllDeadIndicesDo:[:idx | tally := tally - 1] replacingCorpsesWith:DeletedEntry.
- wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ something == #ElementExpired ifTrue:[
+ "
+ must block interrupts here - finalization
+ may be done at low prio in the background
+ finalizer, we do not want to be interrupted
+ while rehashing
+ "
+ wasBlocked := OperatingSystem blockInterrupts.
+ keyArray forAllDeadIndicesDo:[:idx | tally := tally - 1] replacingCorpsesWith:DeletedEntry.
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ].
+
+ "Created: 7.1.1997 / 17:00:33 / stefan"
! !
!WeakIdentitySet methodsFor:'enumerating'!
@@ -169,12 +175,14 @@
|w|
w := WeakArray new:n.
- w watcher:self.
+ w addDependent:self.
^ w
+
+ "Modified: 7.1.1997 / 17:01:28 / stefan"
! !
!WeakIdentitySet class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.20 1997-01-02 18:09:36 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.21 1997-01-08 19:42:17 stefan Exp $'
! !