[BUG][FIX][TEST] Process termination
Stephen Pair
stephen at pairhome.net
Mon Jul 28 13:22:08 UTC 2003
Andreas Raab wrote:
>Run the attached tests to see the effect.
>
>"Change Set: ProcessTerminateFix
>Date: 27 July 2003
>Author: Andreas Raab
>
>When a process is terminated 'from the outside' (e.g., being sent the
>#terminate message without being the active process) it needs to suspend
>itself *before* running any unwind blocks in order to prevent spurious
>errors if the process is being released from the list it is currently
>waiting on."
>
>Cheers,
> - Andreas
>
>
The test ProcessTerminateBug>>testSchedulerTermination is causing a
walkbalk due to the assertion in the forked process. However, SUnit
still reports a success since the assertion happens in the forked
process. Dropping the priority of the forked process causes the
#terminate to happen before the assertion and allows the test to succeed
with no walkback popping up. He is a slightly refined version of the test:
testSchedulerTermination
| process sema gotHere sema2 |
gotHere := false.
sema := Semaphore new.
sema2 := Semaphore new.
process := [
sema signal.
sema2 wait.
"will be suspended here"
gotHere := true. "e.g., we must *never* get here"
] forkAt: Processor activeProcess priority.
sema wait. "until process gets scheduled"
process terminate.
sema2 signal.
Processor yield. "will give process a chance to continue and
horribly screw up"
self assert: gotHere not.
More information about the Squeak-dev
mailing list
|