Problem report on the usage of Structured Concurrency (5th preview)

Adam Warski adam at warski.org
Sun Oct 5 15:16:38 UTC 2025


> I fail to understand this; I have not tested STS extensively.
> Is it not the case that an inner scope will be cancelled when its parent scope is cancelled?
> The forked subtask would be joining the inner scope; will this inner join not be cancelled when the outer join is cancelled?
> In what sense does an inner scope not participate in the same error handling as the outer scope?

Yes, you’re right, if the parent scope is cancelled, this will interrupt the thread running the child scope. If the child scope is waiting on scope.join() (or starts to wait on that method soon enough), the child scope will be properly cancelled and shut down as well.

However, the problem we’re considering here is failure in the child scope, or rather that moving any blocking logic from the parent’s scope body, to the child scope body, doesn’t solve anything. Failure of forks in the child scope won’t interrupt (cancel) the child scope’s body, just as it wouldn’t interrupt (cancel) the parent’s scope body. Given, of course, that the child/parent scope body is blocked on something else than scope.join().

Adam

-- 
Adam Warski

https://warski.org



More information about the loom-dev mailing list