Semaphore.st
changeset 770 402958905760
parent 769 84cc1b36f27e
child 926 101239898989
--- a/Semaphore.st	Sat Dec 16 02:16:25 1995 +0100
+++ b/Semaphore.st	Sat Dec 16 02:23:39 1995 +0100
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.8 on 14-dec-1995 at 18:58:50'                   !
-
 Object subclass:#Semaphore
 	instanceVariableNames:'count waitingProcesses'
 	classVariableNames:''
@@ -320,7 +318,7 @@
 
 waitWithTimeout:seconds
     "wait for the semaphore, but abort the wait after some time.
-     return true if semaphore triggered normal, false if we return
+     return the receiver if semaphore triggered normal, nil if we return
      due to a timeout. With zero timeout, this can be used to poll
      a semaphore (which is not the intend of semaphores, though)."
 
@@ -333,15 +331,15 @@
      go mad ... (especially be careful when adding a debugPrint-here)
     "
     count ~~ 0 ifTrue:[
-	count := count - 1.
-	^ true
+        count := count - 1.
+        ^ self
     ].
 
     "
      with zero-timeout, this is a poll
     "
     seconds = 0 ifTrue:[
-	^ false
+        ^ nil
     ].
 
     current := Processor activeProcess.
@@ -364,31 +362,32 @@
      suspend.
     "
     [count == 0] whileTrue:[
-	waitingProcesses add:current.
+        waitingProcesses add:current.
 
-	timeoutOccured := false.
-	"
-	 for some more descriptive info in processMonitor ...
-	 ... set the state to #wait (instead of #suspend)
-	"
-	current suspendWithState:#wait.
+        timeoutOccured := false.
+        "
+         for some more descriptive info in processMonitor ...
+         ... set the state to #wait (instead of #suspend)
+        "
+        current suspendWithState:#wait.
 
-	timeoutOccured ifTrue:[
-	    waitingProcesses remove:current ifAbsent:[].
-	    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-	    ^ false
-	].
+        timeoutOccured ifTrue:[
+            waitingProcesses remove:current ifAbsent:[].
+            wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+            ^ nil
+        ].
     ].
     Processor removeTimedBlock:unblock.
     count := count - 1.
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-    ^ true
+    ^ self
 
     "Modified: 13.12.1995 / 13:27:24 / stefan"
+    "Modified: 16.12.1995 / 02:21:19 / cg"
 ! !
 
 !Semaphore class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Semaphore.st,v 1.27 1995-12-16 01:16:25 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Semaphore.st,v 1.28 1995-12-16 01:23:39 cg Exp $'
 ! !