help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Issue with process.st and preemptive mode


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] Issue with process.st and preemptive mode
Date: Mon, 10 May 2010 17:40:31 +0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Thunderbird/3.0.4

Hi all,

for the last few hours I am enjoying a flight with power outlets and I
was poking the VM with pre-emtpive mode.

The symptom is that make check will just hang. I have traced it down to
one of the Evals.

Eval [
    | queue stop s |
    queue := SharedQueue new.
    stop := false.
    s := Semaphore new.
    [ s signal.
      [ stop ] whileFalse: [ queue nextPut: true. Processor yield ] ] fork.
    s wait.
    [ (Delay forMilliseconds: 500) wait. stop := true ] fork.
    [ stop ] whileFalse: [ queue nextPut: false. Processor yield ].
]

I have not found a solution yet but I feel like sharing my observations.
It seems to work fine when the the Delay thread is exiting first (of
course it has to) and then the mainThread (as this appears to make us
quit). It is going horrible wrong when one of the threads have evaluated
the whileFalse: [] and the next executiog to execute is Processor yield,
then the Delay thread is exiting, the other thread as well and then the
"Processor yield" will suspend the whole VM as it would schedule it self.

Is that the expected behaviour? Should there be some code to check if a
process has recently exited and then not yield the Process but cycle
it once more?


regards
        holger



reply via email to

[Prev in Thread] Current Thread [Next in Thread]