Single Thread Continuation
Attila Kelemen
attila.kelemen85 at gmail.com
Mon Jul 3 10:40:43 UTC 2023
Alex Otenko <oleksandr.otenko at gmail.com> ezt írta (időpont: 2023. júl. 3.,
H, 12:29):
> Well, convenient or not, closing is necessary. How else can a generator
> tell the consumer that no more values are forthcoming?
>
>
>From the generator side there is no issue, and closing is also not an
issue, since the code just returns which clearly signals the end of the
iteration, and after that `hasNext` will just return false.
> Ditto for closing the channel by the consumer. Barring advanced cases with
> sharing the generator, you can have try-with-resources take care of closing
> things for you.
>
>>
>>
It shouldn't be necessary for a generator, because the `Iterator`
eventually becomes unreachable, so everything should be eligible for
garbage collection, including the continuation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230703/5589b4a1/attachment.htm>
More information about the loom-dev
mailing list