Model.st
changeset 318 097d70e8163f
parent 238 a179b5d6152e
child 337 e6642ba7cca9
--- a/Model.st	Thu Jul 11 21:15:48 1996 +0200
+++ b/Model.st	Fri Jul 19 12:45:07 1996 +0200
@@ -17,7 +17,7 @@
 	category:'Interface-Support-Models'
 !
 
-!Model class methodsFor:'documentation'!
+!Model  class methodsFor:'documentation'!
 
 copyright
 "
@@ -78,6 +78,9 @@
 addDependent:anObject
     "make the argument, anObject be a dependent of the receiver"
 
+    |wasBlocked|
+
+    wasBlocked := OperatingSystem blockInterrupts.
     [
         |deps|
 
@@ -98,9 +101,13 @@
                 dependents := IdentitySet with:dependents with:anObject
             ]
         ]
-    ] valueUninterruptably
+    ] valueNowOrOnUnwindDo:[
+        wasBlocked ifFalse:[
+            OperatingSystem unblockInterrupts
+        ]
+    ]
 
-    "Modified: 19.4.1996 / 12:24:46 / cg"
+    "Modified: 19.7.1996 / 12:39:22 / cg"
 !
 
 dependents
@@ -158,6 +165,14 @@
 removeDependent:anObject
     "make the argument, anObject be independent of the receiver"
 
+    |wasBlocked|
+
+    "/ must do this save from interrupts, since the dependents collection
+    "/ is possibly accessed from multiple threads.
+    "/ Used to use #valueUninterruptably here; inlined that code for slightly
+    "/ faster execution.
+
+    wasBlocked := OperatingSystem blockInterrupts.
     [
         |deps sz dep|
 
@@ -178,9 +193,13 @@
                 dependents := nil
             ]
         ]
-    ] valueUninterruptably
+    ] valueNowOrOnUnwindDo:[
+        wasBlocked ifFalse:[
+            OperatingSystem unblockInterrupts
+        ]
+    ]
 
-    "Modified: 19.4.1996 / 12:24:24 / cg"
+    "Modified: 19.7.1996 / 12:40:59 / cg"
 ! !
 
 !Model methodsFor:'dependents access (non weak)'!
@@ -225,8 +244,8 @@
     "Created: 19.4.1996 / 12:19:40 / cg"
 ! !
 
-!Model class methodsFor:'documentation'!
+!Model  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Model.st,v 1.24 1996-05-02 13:28:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Model.st,v 1.25 1996-07-19 10:45:07 cg Exp $'
 ! !