use inline interrupt blocking in dependents acces methods.
--- a/Object.st Fri Jul 19 12:26:56 1996 +0200
+++ b/Object.st Fri Jul 19 12:44:16 1996 +0200
@@ -1750,28 +1750,40 @@
addDependent:anObject
"make the argument, anObject be a dependent of the receiver"
- |deps|
-
+ |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 := self dependents.
-
- "/ to save a fair amount of memory in case of
- "/ many dependencies, we store a single dependent in
- "/ a WeakArray, and switch to a WeakSet if more dependents are
- "/ added.
-
- deps isNil ifTrue:[
- self dependents:(WeakArray with:anObject)
- ] ifFalse:[
- deps class == WeakArray ifTrue:[
- self dependents:(WeakIdentitySet with:(deps at:1) with:anObject)
- ] ifFalse:[
- deps add:anObject
- ]
- ]
- ] valueUninterruptably
-
- "Modified: 2.2.1996 / 11:04:31 / cg"
+ |deps|
+
+ deps := self dependents.
+
+ "/ to save a fair amount of memory in case of
+ "/ many dependencies, we store a single dependent in
+ "/ a WeakArray, and switch to a WeakSet if more dependents are
+ "/ added.
+
+ deps isNil ifTrue:[
+ self dependents:(WeakArray with:anObject)
+ ] ifFalse:[
+ deps class == WeakArray ifTrue:[
+ self dependents:(WeakIdentitySet with:(deps at:1) with:anObject)
+ ] ifFalse:[
+ deps add:anObject
+ ]
+ ]
+ ] valueNowOrOnUnwindDo:[
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
+ ]
+
+ "Modified: 19.7.1996 / 12:38:50 / cg"
!
dependents
@@ -1831,6 +1843,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 n|
@@ -1857,9 +1877,13 @@
]
]
]
- ] valueUninterruptably.
-
- "Modified: 19.4.1996 / 11:44:31 / cg"
+ ] valueNowOrOnUnwindDo:[
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
+ ]
+
+ "Modified: 19.7.1996 / 12:40:23 / cg"
! !
!Object methodsFor:'dependents access (nonWeak)'!
@@ -1870,9 +1894,17 @@
garbage collected unless the dependency is removed.
This is a private mechanism, for directed dependencies."
- |deps|
-
+ |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|
+
deps := self nonWeakDependents.
"/ to save a fair amount of memory in case of
@@ -1889,10 +1921,14 @@
deps add:anObject
]
]
- ] valueUninterruptably
+ ] valueNowOrOnUnwindDo:[
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
+ ]
"Created: 19.4.1996 / 10:54:08 / cg"
- "Modified: 19.4.1996 / 12:32:28 / cg"
+ "Modified: 19.7.1996 / 12:41:44 / cg"
!
nonWeakDependents
@@ -1924,6 +1960,14 @@
"remove a nonWeak dependency from the receiver to the argument, anObject.
(i.e. make it 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 n|
@@ -1944,10 +1988,14 @@
]
]
]
- ] valueUninterruptably
+ ] valueNowOrOnUnwindDo:[
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
+ ]
"Created: 19.4.1996 / 11:44:44 / cg"
- "Modified: 19.4.1996 / 12:32:10 / cg"
+ "Modified: 19.7.1996 / 12:42:08 / cg"
! !
!Object methodsFor:'error handling'!
@@ -5181,6 +5229,6 @@
!Object class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.127 1996-07-10 10:12:48 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.128 1996-07-19 10:44:16 cg Exp $'
! !
Object initialize!