Problem report on the usage of Structured Concurrency (5th preview)
Andrew Haley
aph-open at littlepinkcloud.com
Tue Sep 30 13:12:14 UTC 2025
On 29/09/2025 11:15, Adam Warski wrote:
> I view SCS as the new base building block for IO-bound concurrency in
Java, and that any future concurrency libraries or projects should use
it. This is supported by the fact that `ScopedValue`s are only inherited
within SCSs - and I think any concurrency library or feature should
provide such propagation. Hence, it should build on top of SCS. That’s
why I’m seeking how to make SCS more flexible, to accommodate also for
the more unusual or advanced use-cases.
and
> (And using STS might not be just a whim, we might **have to** to use
it, as we might need ScopedValues propagation, or we want the guarantee,
that no thread leaks are possible)
but the JEP says
It is not a goal to create the definitive structured concurrency
API for all Java programs. Other structured concurrency constructs can
be defined by third-party libraries or in future JDK releases.
...so I have to differ from your view that "any future concurrency
libraries or projects should use [StructuredtaskScope]."
But I take your point about ScopedValue. It is possible that if we can
find a secure way to manage the lifetime of scoped values in subtasks,
we will do it. This is something we're thinking about.
--
Andrew Haley (he/him)
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the loom-dev
mailing list