On 25/09/2025 06:38, [email protected] wrote:
:The problem, is that this check is a kind of weak, because you can write try(var sts = STS.open()) { var subtask = sts.fork(callable); // spurious STS are back ! Thread.ofVirtual().start(() -> IO.println(subtask.get())).join(); sts.join(); }
It's only interesting to call Subtask::get in the main task (after join) or in a custom Joiner's onComplete when the thread that executed the subtask completes. The specified seat belt is to avoid a mistake in the main task where code might attempt to get the result before joining. It would of course feasible to specify it be not allowed from other random threads that happen to get a reference to the subtask, but it would add overhead to cater for a very off-piste usage.
-Alan
