[squeak-dev] The Inbox: Compiler-mt.456.mcz
Jaromir
m at jaromir.net
Tue Feb 2 21:59:21 UTC 2021
Actually, I'd place the problem in Process>>#priority: method - it should
make sure that if the active process downgrades it's priority below an
existing runnable process, the active process will automatically be
preempted - something like this (works for your examples):
Process>>priority: anInteger
"Set the receiver's priority to anInteger."
(anInteger >= Processor lowestPriority and:[anInteger <= Processor
highestPriority])
ifTrue: [
priority := anInteger.
(self isActiveProcess and: [anInteger < Processor nextReadyProcess
priority])
ifTrue: [ [self resume] fork. self suspend ]
]
ifFalse: [self error: 'Invalid priority: ', anInteger printString]
And then the #yield primitive can remain as it is :)
J
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html
More information about the Squeak-dev
mailing list
|