WeakValueDictionary.st
changeset 6347 1268259f426a
parent 6330 fb4caca5b504
child 7998 ebf52929e24b
--- a/WeakValueDictionary.st	Fri Dec 21 11:59:16 2001 +0100
+++ b/WeakValueDictionary.st	Fri Dec 21 13:17:20 2001 +0100
@@ -62,10 +62,14 @@
 !WeakValueDictionary methodsFor:'adding & removing'!
 
 at:key ifAbsent:somethingRespondingToValue
+    "
+     Redefined to block interrupts, to avoid trouble when dependencies
+     are added within interrupting high prio processes.
+    "
+
     |ret|
 
     [
-        "/ already blocked
         ret := super at:key ifAbsent:[^ somethingRespondingToValue value].
         ret = 0 ifTrue:[
             ret := somethingRespondingToValue value
@@ -78,6 +82,7 @@
     "return the element indexed by aKey if present,
      if not present, store the result of evaluating valueBlock
      under aKey and return it.
+
      Redefined to block interrupts, to avoid trouble when dependencies
      are added within interrupting high prio processes.
      WARNING: do not add elements while iterating over the receiver.
@@ -85,16 +90,9 @@
 
     |ret|
 
-    (OperatingSystem blockInterrupts) ifTrue:[
-        "/ already blocked
-        ^ super at:key ifAbsentPut:anObject
-    ].
-
     [
         ret := super at:key ifAbsentPut:anObject.
-    ] valueNowOrOnUnwindDo:[
-        OperatingSystem unblockInterrupts
-    ].
+    ] valueUninterruptably.
     ^ ret
 !
 
@@ -106,16 +104,9 @@
 
     |ret|
 
-    (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super at:key put:anObject
-    ].
-
     [
-	ret := super at:key put:anObject.
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts
-    ].
+        ret := super at:key put:anObject.
+    ] valueUninterruptably.
     ^ ret
 
     "Modified: 6.5.1996 / 12:22:26 / stefan"
@@ -135,16 +126,9 @@
 
     |ret|
 
-    (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super removeKey:aKey ifAbsent:aBlock
-    ].
-
     [
-	ret := super removeKey:aKey ifAbsent:aBlock
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts
-    ].
+        ret := super removeKey:aKey ifAbsent:aBlock
+    ] valueUninterruptably.
     ^ ret
 
     "Modified: 6.5.1996 / 12:44:07 / stefan"
@@ -163,16 +147,9 @@
 
     |ret|
 
-    (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super removeValue:aKey ifAbsent:aBlock
-    ].
-
     [
-	ret := super removeValue:aKey ifAbsent:aBlock
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts
-    ].
+        ret := super removeValue:aKey ifAbsent:aBlock
+    ] valueUninterruptably.
     ^ ret.
 
     "Created: 6.5.1996 / 14:47:37 / stefan"
@@ -253,16 +230,9 @@
 
     |val|
 
-    (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super includes:anObject.
-    ].
-
     [
-	val := super includes:anObject.
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts.
-    ].
+        val := super includes:anObject.
+    ] valueUninterruptably.
     ^ val
 
     "Modified: 6.5.1996 / 12:22:26 / stefan"
@@ -276,16 +246,9 @@
 
     |val|
 
-    (OperatingSystem blockInterrupts) ifTrue:[
-	"/ already blocked
-	^ super includesKey:key.
-    ].
-
     [
-	val := super includesKey:key.
-    ] valueNowOrOnUnwindDo:[
-	OperatingSystem unblockInterrupts.
-    ].
+        val := super includesKey:key.
+    ] valueUninterruptably.
     ^ val
 
     "Modified: 6.5.1996 / 12:22:26 / stefan"
@@ -296,5 +259,5 @@
 !WeakValueDictionary class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/WeakValueDictionary.st,v 1.14 2001-12-17 13:30:54 martin Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/WeakValueDictionary.st,v 1.15 2001-12-21 12:17:20 cg Exp $'
 ! !