Hi,

I've fixed Process>>#priority: it checks if the process is ready (with the new priority)
but it must used the old priority.

Gwen

>From 002c7a903879f7fbae93239cc527519dc40ffd70 Mon Sep 17 00:00:00 2001
From: Gwenael Casaccio <[email protected]>
Date: Mon, 24 Mar 2014 15:17:22 +0100
Subject: [PATCH 3/3] Fix Process>>#priority: checks if myList is the process
 old priority queue and resume it (put it in new priority queue)

---
 ChangeLog         | 5 +++++
 kernel/Process.st | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3598812..285a65a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2014-03-24  Gwenael Casaccio  <[email protected]>
 
+	* kernel/Process.st: Fix the implementation of Process>>priority: it checks in the old
+	priority queue if the process was ready and resume it if so.
+
+2014-03-24  Gwenael Casaccio  <[email protected]>
+
 	* kernel/Process.st: Remve Process>>#startExecution:.
 
 2014-03-24  Gwenael Casaccio  <[email protected]>
diff --git a/kernel/Process.st b/kernel/Process.st
index 37dd1a8..ef0e7d4 100644
--- a/kernel/Process.st
+++ b/kernel/Process.st
@@ -254,12 +254,12 @@ can suspend themselves and resume themselves however they wish.'>
 			and: Processor highestPriority].
 
 	[
-	    | activePriority |
-            activePriority := Processor activePriority.
+	    | oldPriority |
+            oldPriority := priority.
 	    priority := anInteger.
 	    "Atomically move the process to the right list, preempting
              the current process if necessary."
-            self isReady ifTrue: [self resume].
+            myList == (Processor processesAt: oldPriority) ifTrue: [self resume].
 	] valueWithoutPreemption
     ]
 
-- 
1.8.3.2

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to