WeakIdentitySet.st
changeset 2091 c11bb3e29a1b
parent 2026 654cba4db794
child 2102 7a0e81ed345b
equal deleted inserted replaced
2090:42653edf4cc5 2091:c11bb3e29a1b
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
       
    12 
       
    13 'From Smalltalk/X, Version:3.1.3 on 7-jan-1997 at 17:23:23'                     !
    12 
    14 
    13 IdentitySet subclass:#WeakIdentitySet
    15 IdentitySet subclass:#WeakIdentitySet
    14 	instanceVariableNames:''
    16 	instanceVariableNames:''
    15 	classVariableNames:''
    17 	classVariableNames:''
    16 	poolDictionaries:''
    18 	poolDictionaries:''
   116     "Modified: 1.3.1996 / 21:16:10 / cg"
   118     "Modified: 1.3.1996 / 21:16:10 / cg"
   117 ! !
   119 ! !
   118 
   120 
   119 !WeakIdentitySet methodsFor:'element disposal'!
   121 !WeakIdentitySet methodsFor:'element disposal'!
   120 
   122 
   121 informDispose
   123 update:something with:aParameter from:changedObject
   122     "an element died - must rehash"
   124     "an element died - must rehash"
   123 
   125 
   124     |wasBlocked|
   126     |wasBlocked|
   125 
   127 
   126     "
   128     something == #ElementExpired ifTrue:[
   127      must block interrupts here - finalization
   129         "
   128      may be done at low prio in the background
   130          must block interrupts here - finalization
   129      finalizer, we do not want to be interrupted
   131          may be done at low prio in the background
   130      while rehashing
   132          finalizer, we do not want to be interrupted
   131     "
   133          while rehashing
   132     wasBlocked := OperatingSystem blockInterrupts.
   134         "
   133     keyArray forAllDeadIndicesDo:[:idx | tally := tally - 1] replacingCorpsesWith:DeletedEntry.
   135         wasBlocked := OperatingSystem blockInterrupts.
   134     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
   136         keyArray forAllDeadIndicesDo:[:idx | tally := tally - 1] replacingCorpsesWith:DeletedEntry.
       
   137         wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
       
   138     ].
       
   139 
       
   140     "Created: 7.1.1997 / 17:00:33 / stefan"
   135 ! !
   141 ! !
   136 
   142 
   137 !WeakIdentitySet methodsFor:'enumerating'!
   143 !WeakIdentitySet methodsFor:'enumerating'!
   138 
   144 
   139 do:aBlock
   145 do:aBlock
   167      use WeakArrays here."
   173      use WeakArrays here."
   168 
   174 
   169     |w|
   175     |w|
   170 
   176 
   171     w := WeakArray new:n.
   177     w := WeakArray new:n.
   172     w watcher:self.
   178     w addDependent:self.
   173     ^ w
   179     ^ w
       
   180 
       
   181     "Modified: 7.1.1997 / 17:01:28 / stefan"
   174 ! !
   182 ! !
   175 
   183 
   176 !WeakIdentitySet class methodsFor:'documentation'!
   184 !WeakIdentitySet class methodsFor:'documentation'!
   177 
   185 
   178 version
   186 version
   179     ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.20 1997-01-02 18:09:36 ca Exp $'
   187     ^ '$Header: /cvs/stx/stx/libbasic/WeakIdentitySet.st,v 1.21 1997-01-08 19:42:17 stefan Exp $'
   180 ! !
   188 ! !