help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH] kernel: Check the Semaphore before queuing the


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] [PATCH] kernel: Check the Semaphore before queuing the interrupt
Date: Mon, 20 Jan 2014 17:13:56 +0100

While porting Phexample I noticed that the interrupt was queued
long after the Delay has stopped and the process continued. It
was interrupted at the wrong point. Check the Semaphore for signals
before queuing the interrupt.

I think the race-free operation should make sure that the process
can't wake up if it is still sleeping, then check sem and then
schedule the interrupt and resume the process (if needed).

2014-01-20  Holger Hans Peter Freyther  <address@hidden>

        * kernel/Delay.st: Check the Semaphore before queuing the
        interrupt for the target process.
---
 ChangeLog       | 5 +++++
 kernel/Delay.st | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 46a0bc5..ed928cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-20  Holger Hans Peter Freyther  <address@hidden>
+
+       * kernel/Delay.st: Check the Semaphore before queuing the
+       interrupt for the target process.
+
 2014-01-19  Gwenael Casaccio  <address@hidden>
 
        * kernel/MethodDict.st: Introduce >>#select: and
diff --git a/kernel/Delay.st b/kernel/Delay.st
index 47f40bb..df4417a 100644
--- a/kernel/Delay.st
+++ b/kernel/Delay.st
@@ -308,7 +308,8 @@ created.'>
 
                 "Wait and see if it is timed out. If so send a signal."
                 (self timedWaitOn: sem) ifTrue: [
-                   proc signalInterrupt: (Kernel.TimeoutNotification on: self).
+                   sem signals = 0 ifTrue: [
+                        proc signalInterrupt: (Kernel.TimeoutNotification on: 
self)].
                 ].
             ] fork.
 
-- 
1.8.5.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]