--- a/SharedQueue.st Fri May 18 00:29:23 2001 +0200
+++ b/SharedQueue.st Wed Jun 13 10:17:35 2001 +0200
@@ -128,6 +128,26 @@
^ value.
!
+nextIfEmpty:exceptionValue
+ "return the next value in the queue; if it its empty do not wait, but return
+ the value of exceptionValue.
+ When a datum has been removed, signal space-availability to writers"
+
+ |value anyRemoved|
+
+ accessLock critical:[
+ self isEmpty ifTrue:[
+ value := exceptionValue value
+ ] ifFalse:[
+ value := super next.
+ anyRemoved := true.
+ ]
+ ].
+ anyRemoved == true ifTrue:[spaceAvailable signal].
+
+ ^ value.
+!
+
nextPut:anObject
"enter anObject into the queue; wait for available space, if
the queue is full. After the put, signal availablity of a datum
@@ -219,5 +239,5 @@
!SharedQueue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/SharedQueue.st,v 1.24 2000-12-01 17:15:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/SharedQueue.st,v 1.25 2001-06-13 08:17:35 cg Exp $'
! !