// this assures that cancelling threads made in the same realm works. // for cancelling across realms, another test would be needed. svoid testThreadCancellation() { new Flag flag; Thread t = startThread("testThreadCancellation", r { try { busySleepSeconds(20.0); } finally { flag.raise(); } }); sleepSeconds(1.0); assertFalse(flag.isUp()); cancelThread(t); assertTrue(waitUntil(50, 2.0, () -> flag.isUp())); print("Local thread cancellation works"); }