On 2 May 2013 16:39, Igor Stasenko <siguc...@gmail.com> wrote:
> On 2 May 2013 15:33, Henrik Johansen <henrik.s.johan...@veloxit.no> wrote:
>>
>> On May 2, 2013, at 2:50 PM, Igor Stasenko wrote:
>>
>>> On 2 May 2013 09:54, Henrik Johansen <henrik.s.johan...@veloxit.no> wrote:
>>>> What?
>>>> I am 99.99% sure it used to interrupt the GUI process if no other viable 
>>>> candidate could be found, why change that?
>>>> At least in my mind, if you hit cmd - dot, either you want to interrupt 
>>>> some process blocking the UI on a higher priority, or you want the UI 
>>>> process itself.
>>>> For everything else, there's the Process Browser.
>>>>
>>>
>>> It was never like that.
>>> It was always looking for a process which is scheduled, but not
>>> interrupt process itself.
>>> usually that meant it interrupts things like finalization process,
>>> so i added logic to avoid interrupting it unless there's nothing else
>>> to interrupt.
>>
>> From 1.4:
>> handleUserInterrupt
>> [|toInterrupt|
>>                         toInterrupt := Processor preemptedProcess.
>>                         "Only interrupt processes which are potentially 
>> blocking the UI"
>>                         toInterrupt priority <  UIManager default uiProcess 
>> priority ifTrue: [toInterrupt := Project uiProcess].
>>
>> So yes, it was like that.
>> (barring the other flaws you mentioned, about potentially interrupting 
>> critical high-priority processes)
>>
> Okay, then we need to change #ifNil clause in following method to just
> interrupt UI process,
> instead of showing useless "not interruptable" message:
>
> handleUserInterrupt
>         "This will be called from the event-fetcher process.
>         Assume no system-vital processes have a lower priority than this, and
> are thus ok to interrupt"
>         UserInterruptHandler cmdDotEnabled ifFalse: [ ^ self ].
>
>         [
>                 self processToInterrupt
>                         ifNotNil: [ :proc | proc debugWithTitle: 'User 
> Interrupt' ]
>                         ifNil: [ UIManager default inform: 'Process not 
> interruptable' ]
>
>         "fork exceptions, we don't want interrupt handler to die"
>         ] on: Error fork: [:ex | ex pass].
>

oh.. on second thought, even better..

processToInterrupt
        "look for best candidate to interrupt:
           first who is not weak-finalization process
           and only then weak-finalization process, if nothing left to 
interrupt.
        
          filter out the idle process, since killing it is fatal
        "
        | list |
        
        list := OrderedCollection new.
        Processor scanSchedule: [:p |
                "gather everything but idle process, and processes whose
suspendedContext sender == nil,
                which usually means that process is only scheduled but had no 
chance to run"
                
                ((p ~~ Processor backgroundProcess) and: [ p suspendedContext 
sender notNil ])
                        ifTrue: [ list add: p ] ] startingAt: Processor 
activePriority.
        
        "now answer first process in list, skipping the finalization process"
        list do: [:p | p ==  WeakArray runningFinalizationProcess ifFalse: [ ^ 
p ] ].
        
        "now answer first process , if any ,otherwise answer ui process by 
default"
        ^ list isEmpty ifTrue: [ UIManager default uiProcess ] ifFalse: [ list 
first ]


so it interrupts
even if i do

1 hour wait

in workspace

>> Cheers,
>> Henry
>
>
>
> --
> Best regards,
> Igor Stasenko.



-- 
Best regards,
Igor Stasenko.

Reply via email to