Issue 94: fixed a bad bug in #acquireWithTimeoutMs: jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 11 Dec 2017 14:14:42 +0000
branchjv
changeset 23095 a5d786f8ebc6
parent 23094 664a6370e264
child 23096 36e1c7a471ab
Issue 94: fixed a bad bug in #acquireWithTimeoutMs: Obviously, we MUST check whether we the wait for lock timed out or not. How comes I did not notice before? Maybe my Linux machine is so fast it never timed out. Sigh.
AbstractLock.st
--- a/AbstractLock.st	Mon Dec 11 11:36:00 2017 +0000
+++ b/AbstractLock.st	Mon Dec 11 14:14:42 2017 +0000
@@ -188,8 +188,10 @@
         "/ in case the Semaphore >> #wait is prematurely terminated.
         "/ Q: Can this actually happen? If so, how?
         acquired := sema waitWithTimeoutMs: timeout.
-        process := active.
-        count := 1.
+        acquired notNil ifTrue:[
+            process := active.
+            count := 1.
+        ].
         wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ] ifCurtailed:[
         acquired notNil ifTrue:[
@@ -203,6 +205,7 @@
     ^acquired notNil.
 
     "Created: / 25-08-2017 / 22:55:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-12-2017 / 14:11:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 release