--- a/SharedQueue.st Fri Dec 01 18:12:44 2000 +0100
+++ b/SharedQueue.st Fri Dec 01 18:15:49 2000 +0100
@@ -120,9 +120,9 @@
|value|
dataAvailable wait.
- accessLock wait.
- value := super next.
- accessLock signal.
+ accessLock critical:[
+ value := super next.
+ ].
spaceAvailable signal.
^ value.
@@ -134,22 +134,13 @@
to readers."
spaceAvailable wait.
- accessLock wait.
- super nextPut:anObject.
- accessLock signal.
+ accessLock critical:[
+ super nextPut:anObject.
+ ].
dataAvailable signal.
^ anObject.
!
-readSemaphore
- "return the semaphore which is signalled when data is available
- for reading."
-
- ^ dataAvailable
-
- "Modified: 16.12.1995 / 13:47:11 / cg"
-!
-
removeAll
"remove all elements in the queue; do not wait, but
synchronize access to the queue.
@@ -184,6 +175,23 @@
spaceAvailable signal.
^ value.
+! !
+
+!SharedQueue methodsFor:'accessing-internals'!
+
+readSemaphore
+ "return the semaphore which is signalled when data is available
+ for reading."
+
+ ^ dataAvailable
+
+ "Modified: 16.12.1995 / 13:47:11 / cg"
+!
+
+withAccessLockedDo:aBlock
+ "evaluate aBlock while access via next/nextPut are blocked."
+
+ accessLock critical:aBlock
!
writeSemaphore
@@ -203,7 +211,7 @@
super init:size.
dataAvailable := Semaphore new name:'shared q-read'.
spaceAvailable := (Semaphore new:size) name:'shared q-write'.
- accessLock := Semaphore forMutualExclusion.
+ accessLock := RecursionLock new.
"Modified: 25.1.1997 / 00:19:45 / cg"
! !
@@ -211,5 +219,5 @@
!SharedQueue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/SharedQueue.st,v 1.23 2000-11-03 16:48:30 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/SharedQueue.st,v 1.24 2000-12-01 17:15:49 cg Exp $'
! !