[squeak-dev] OSProcess question

Hans-Martin Mosner hmm at heeg.de
Tue Mar 11 07:24:29 UTC 2008


David T. Lewis schrieb:
> On Mon, Mar 10, 2008 at 11:13:42AM -0700, Andreas Raab wrote:
>   
>> We have a situation where some code reliably locks up when used like here:
>>
>>  p := OSProcess command: 'chmod +x ', path.
>>  [p isComplete] whileFalse.
>>
>> This hangs quite reliably in the second line and I'm *assuming* that we 
>> need to yield/delay execution while waiting. Is this correct? I was 
>> trying to trace through the code paths which update the runState but it 
>> wasn't immediately clear where this comes from.
>>     
>
> Hi Andreas,
>
> Yes, you should add a delay in the loop, or use this (which adds the
> delay for you):
>
>   p := OSProcess waitForCommand: 'chmod +x ', path
>
> The run state of an external OS process is updated by a separate Squeak
> process (evaluate "OSProcess accessor grimReaperProcess"), so you need
> to wait for the grimReaperProcess to react to the external process
> exit notification.
This sounds like the grimReaperProcess should be given higher priority
so it would not be starved by a busy-waiting foreground process.
I'd suggest at least Processor lowIPPriority.

Cheers,
Hans-Martin



More information about the Squeak-dev mailing list