<div dir="ltr"><div dir="ltr">Andrew Haley <<a href="mailto:aph-open@littlepinkcloud.com">aph-open@littlepinkcloud.com</a>> ezt írta (időpont: 2023. jún. 2., P, 11:18):<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 6/1/23 20:06, Attila Kelemen wrote:<br>
> As for your concern: You are already screwed :) In fact, I have realized<br>
> that I have a (horrible) way to implement what I want with<br>
> `StructuredTaskScope`, because when I'm binding the factory in my example,<br>
> I can open a new STS, fork a task immediately which will just stop and wait<br>
> and when down the line the "resource"<br>
<br>
What's horrible about it? You create a bunch of threads in a<br>
StructuredTaskScope, and the threads handle tasks in that<br>
context. Everything is nicely structured, so there's no need to<br>
do anything underhand. Any time you need another worker thread<br>
a StructuredTaskScope can fork one.<br>
<br>
You're using scopes in exactly the way they are intended to be used.<br>
No extra runtime checking is needed.<br><br></blockquote><div><br></div><div>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).</div><div> </div><div>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.</div></div></div>