RecursionLock.st
changeset 3670 91b4524a74b3
parent 3524 b5fe623f0e4d
child 4938 d5640f1c8894
--- a/RecursionLock.st	Tue Jul 21 17:45:49 1998 +0200
+++ b/RecursionLock.st	Tue Jul 21 17:46:36 1998 +0200
@@ -150,45 +150,47 @@
 
     active := Processor activeProcess.
     process == active ifTrue:[
-        retVal := aBlock value
-    ] ifFalse:[
-        "/
-        "/ sema wait & process := active
-        "/ and:
-        "/ proces := nil & sema signal
-        "/ must both be done atomic
-        "/ Scenario:
-        "/   ... recLock critical
-        "/         got lock
-        "/         evaluated
-        "/         set process to nil
-        "/         -> timer interrupt
-        "/              recLock critical in timeOut action
-        "/              process isNil
-        "/                 sema wait !!!!!! DEADLOCK
-        "/
-        wasBlocked := OperatingSystem blockInterrupts.
-        sema critical:[
-            [
-                process := active.
-                wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
-                retVal := aBlock value.
-                OperatingSystem blockInterrupts.
-            ] valueOnUnwindDo:[
-                process := nil.
-            ]
-        ].
-        process := nil.
-        wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+        "/ I already have the lock
+        ^ aBlock value
     ].
+
+    "/
+    "/ sema wait & process := active
+    "/ and:
+    "/ proces := nil & sema signal
+    "/ must both be done atomic
+    "/ Scenario:
+    "/   ... recLock critical
+    "/         got lock
+    "/         evaluated
+    "/         set process to nil
+    "/         -> timer interrupt
+    "/              recLock critical in timeOut action
+    "/              process isNil
+    "/                 sema wait !!!!!! DEADLOCK
+    "/
+    wasBlocked := OperatingSystem blockInterrupts.
+    sema critical:[
+        [
+            process := active.
+            wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+            retVal := aBlock value.
+            OperatingSystem blockInterrupts.
+        ] valueOnUnwindDo:[
+            process := nil.
+        ]
+    ].
+    process := nil.
+    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
+
     ^ retVal
 
-    "Modified: / 18.4.1996 / 21:09:39 / cg"
     "Modified: / 5.3.1998 / 10:22:50 / stefan"
+    "Modified: / 21.7.1998 / 17:44:06 / cg"
 ! !
 
 !RecursionLock class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/RecursionLock.st,v 1.20 1998-06-07 00:44:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/RecursionLock.st,v 1.21 1998-07-21 15:46:36 cg Exp $'
 ! !