On 13 June 2018 at 11:46, Ben Coman <btc@openinworld.com> wrote:
I'm not sure if I'm doing the wrong thing, or if I've bumped into a problem with step <Over>.
I'm trying to add some debugging support into multi-threaded code to help properly sequence debugging different priority processes. I've extracted a little demo...

TestCase subclass: #Example
instanceVariableNames: 'doCycle debug highPriorityProcess'
classVariableNames: ''
package: 'KernelX-DelayScheduler'


Example��>>��highPriorityCycle
debug ifTrue: [ self halt ].
Transcript show: 'H'.


Example
�� >> highPriorityRunLoop
doCycle := Semaphore new.
^[ [ doCycle wait.
self highPriorityCycle ] repeat.
] forkAt: 45 named: 'Example high side'


Process >> isWaiting
^myList isKindOf: Semaphore


Example��>>�� wakeHighPriorityLoop
doCycle signal.
debug ifTrue: [�� "wait until high priority process is sleeping"
[ highPriorityProcess isWaiting & highPriorityProcess isTerminated not]��
whileFalse: [��
Transcript show: '.'.��
100 milliSeconds wait ].
self halt
].

To make this example simpler, I changed this method to...
Example >> wakeHighPriorityLoop
|count|
count := 0.
[ Transcript show: '.'.
count := count + 1.
count > 10 ifTrue: [^self].
200 milliSeconds wait.
�� ] repeat.
��


Example��>>����testUserPriority
debug := true.
highPriorityProcess := self highPriorityRunLoop.
Transcript cr.
debug ifTrue: [self halt].
3 timesRepeat: [��
Transcript crShow: 'U'.��
self wakeHighPriorityLoop.].
highPriorityProcess terminate.

and this method to...
Example��>>����testUserPriority
[ 3 timesRepeat: [��
Transcript crShow: 'U'.��
self halt.
self wakeHighPriorityLoop.].
] forkAt: 39 named: 'testUserPriority'.
self halt.
highPriorityProcess terminate.����

So there should be no way that the 39-priority thread should block the 40-priority UI thread.
But when I run #testUserPriority and step <Over>����#wakeHighPriorityLoop
the UI blocks for two seconds and then all of a sudden�� "U..........." appears in full on the Transcript shows.
I'd expect to see the dots slowly appearing one-by-one.
I really don't understand the behaviour I'm seeing.

cheers -ben