<div dir="ltr"><div dir="ltr">Robert Engels <<a href="mailto:rengels@ix.netcom.com">rengels@ix.netcom.com</a>> ezt írta (időpont: 2023. júl. 3., H, 1:58):<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"><div dir="auto"><div dir="ltr"></div><div dir="ltr">When you have virtual threads there is no need for generators - it is simply queues. The typical generator is simply implemented as a task that puts values on a queue with blocking semantics. The rest is syntactic sugar. </div><div dir="ltr"></div><blockquote type="cite"><div dir="ltr"><br></div></blockquote></div></blockquote><div><br></div><div>Though I never checked every detail on how virtual threads are implemented, but your claim looks to be false to me. Consider that you are implementing a normal `Iterator`, and then you don't read the iterator fully. In that case, your virtual thread will be sitting in the scheduler forever waiting to be unblocked, while this is not the case for reasonably implemented generators.</div></div></div>