ScopedValue: Capturing current bindings
Attila Kelemen
attila.kelemen85 at gmail.com
Fri Jun 2 17:46:13 UTC 2023
Andrew Haley <aph-open at littlepinkcloud.com> ezt írta (időpont: 2023. jún.
2., P, 11:18):
> On 6/1/23 20:06, Attila Kelemen wrote:
> > As for your concern: You are already screwed :) In fact, I have realized
> > that I have a (horrible) way to implement what I want with
> > `StructuredTaskScope`, because when I'm binding the factory in my
> example,
> > I can open a new STS, fork a task immediately which will just stop and
> wait
> > and when down the line the "resource"
>
> What's horrible about it? You create a bunch of threads in a
> StructuredTaskScope, and the threads handle tasks in that
> context. Everything is nicely structured, so there's no need to
> do anything underhand. Any time you need another worker thread
> a StructuredTaskScope can fork one.
>
> You're using scopes in exactly the way they are intended to be used.
> No extra runtime checking is needed.
>
>
First of all, I'm not sure why I can't type, but by "when down the line the
resource" I meant "channel down the resource" (not sure how this
monstrosity happened).
What I mean by "horrible", that such implementation is rather complicated
for what it wants to do, and is also very inefficient compared to what the
JDK could do.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230602/21e9ddf2/attachment.htm>
More information about the loom-dev
mailing list