<div dir="ltr"><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><br>
One thing that is helpful to go with your question is to know if
you've tried LinkedTransferQueue or any of the other blocking queues
with virtual threads. Only asking because hearing feedback on using
the existing APIs and hearing about any issues/limitations is always
helpful.<br><br></div></blockquote><div><br></div><div>Telling the queue that the reader went away (maybe crashed) is still awkward. It is less problematic with virtual threads, because you can cheaply start a new virtual thread, and interrupt it more safely. However, that is still not the best, because I want to be able to tell that I'm ending the queue, not the thread (besides, I don't necessarily want to start a new virtual thread, even if it is relatively cheap). Besides, the distinction between closing the queue and doing some larger scope cancellation (especially interrupting a thread) is still important, because - sadly - quite often people swallow interrupted exceptions (sometimes even respectable libraries). Also, while you might be closing the queue, you might not want to interrupt code before and after queue processing. Though it would lead deeper, using interrupt for cancellation is rather annoying anyway (so much so, that I wrote a completely new executor framework mainly because of that, and never looked back).</div></div></div>