--- a/Monitor.st Fri May 03 17:33:31 1996 +0200
+++ b/Monitor.st Fri May 03 18:08:48 1996 +0200
@@ -182,8 +182,30 @@
"Created: 3.5.1996 / 17:24:59 / cg"
! !
+!Monitor methodsFor:'queries'!
+
+isFree
+ "return true, if the monitor is free
+ (i.e. noone waits and count is zero)"
+
+ |wasBlocked ret|
+
+ ret := true.
+
+ wasBlocked := OperatingSystem blockInterrupts.
+ owningProcess notNil ifTrue:[
+ ret := false
+ ] ifFalse:[
+ sema numberOfWaitingProcesses ~~ 0 ifTrue:[ret := false].
+ ].
+ wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+ ^ ret.
+
+ "Created: 3.5.1996 / 18:08:38 / cg"
+! !
+
!Monitor class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/Monitor.st,v 1.1 1996-05-03 15:33:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/Monitor.st,v 1.2 1996-05-03 16:08:48 cg Exp $'
! !