A new version of KernelTests was added to project The Inbox: http://source.squeak.org/inbox/KernelTests-jar.407.mcz
==================== Summary ====================
Name: KernelTests-jar.407 Author: jar Time: 31 May 2021, 11:19:58.858017 pm UUID: 8bb4554a-971d-ea49-9396-6a0c1625fb5b Ancestors: KernelTests-nice.404
Add a test #testTerminateInEnsure presented by Martin McClure at 2019 Smalltalk conference. Test unwind when a process gets terminated inside the #ensure unwind block. Complement latest #terminate in the Inbox.
Supersede KernelTests-jar.405 - fix underscores from Cuis
=============== Diff against KernelTests-nice.404 ===============
Item was added: + ----- Method: ProcessTest>>testTerminateInEnsure (in category 'tests') ----- + testTerminateInEnsure + "As shown in + Martin McClure's 'Threads, Critical Sections, and Termination' (Smalltalks 2019 conference) + https://youtu.be/AvM5YrjK9AE + at 23:17 + self new testTerminateInEnsure + " + | process count random delay | + random := Random new. + 10 timesRepeat: [ + process := [ + count := 0. + [] ensure: [ + 10 timesRepeat: [ + count := count + 1. + 1000000 timesRepeat: [12 factorial]]. + count := count + 1] + ] forkAt: Processor activeProcess priority - 1. + delay := (random next * 100) asInteger + 10. "avoid 0-ms delay" + (Delay forMilliseconds: delay) wait. + self assert: process isTerminated not. + process terminate. + process priority: Processor activeProcess priority + 1. + self + assert: process isTerminated; + assert: count equals: 11 ]!