RecursionLock.st
branchjv
changeset 23087 7da0692e1671
parent 21249 86c01ee5a76e
child 23088 aa14988f9d73
--- a/RecursionLock.st	Mon Jul 31 21:56:39 2017 +0100
+++ b/RecursionLock.st	Tue Aug 08 16:46:35 2017 +0100
@@ -41,7 +41,7 @@
 "
     like a Semaphore for mutual exclusion, but avoids the deadlock
     if a critical region is reentered by the same process again.
-    I.e. allows reentering the critical region IFF the current process 
+    I.e. allows reentering the critical region IFF the current process
     is the one which did the original locking.
 
     WARNING:
@@ -96,7 +96,7 @@
 forMutualExclusion
     "same as new, for easy exchangability with regular mutual-exclusion Semaphores."
 
-    ^ self new 
+    ^ self new
 !
 
 new
@@ -167,13 +167,13 @@
 !
 
 wouldBlock
-    "Check if the resource represented by the receiver is  
+    "Check if the resource represented by the receiver is
      already in use by another process.
      Attention: if asked without some global lock (blockedInterrupts),
      the returned value may be outdated right away."
 
     |p|
-    
+
     ^ (p := process) notNil and:[Processor activeProcess ~~ p and:[p isDead not]]
 ! !
 
@@ -182,6 +182,8 @@
 signal
     |wasBlocked|
 
+    Logger warn: 'RecursionLock >> #signal called'.
+
     process ~~ Processor activeProcess ifTrue:[
         self error:'RecursionLock - signaling process doesn''t own the lock'.
     ].
@@ -224,7 +226,7 @@
     wasBlocked := OperatingSystem blockInterrupts.
     [
         (process notNil and:[process isDead]) ifTrue:[
-            process := nil. 
+            process := nil.
             'RecursionLock [warning]: cleanup lock from dead process' infoPrintCR.
             sema signal.
         ].
@@ -257,7 +259,7 @@
 !
 
 critical:aBlock timeoutMs:timeoutMs ifBlocking:blockingBlock
-    "like critical:, but do not block if the lock cannot be acquired 
+    "like critical:, but do not block if the lock cannot be acquired
      within timeoutMs milliseconds.
      Instead, return the value of blockingBlock."
 
@@ -287,7 +289,7 @@
     wasBlocked := OperatingSystem blockInterrupts.
     [
         (process notNil and:[process isDead]) ifTrue:[
-            process := nil. 
+            process := nil.
             'RecursionLock [warning]: cleanup lock from dead process' infoPrintCR.
             sema signal.
         ].
@@ -327,6 +329,8 @@
 
     |active wasBlocked|
 
+    Logger warn: 'RecursionLock >> #wait called'.
+
     active := Processor activeProcess.
     process == active ifTrue:[
         "I have already got the lock"
@@ -336,7 +340,7 @@
     wasBlocked := OperatingSystem blockInterrupts.
     (process notNil and:[process isDead]) ifTrue:[
         "/ a process which had the lock died without a chance to release it (i.e. it was hard terminated)
-        process := nil. 
+        process := nil.
         'RecursionLock [info]: cleanup leftover lock from dead process' infoPrintCR.
         sema signal.
     ].