<div dir="auto"><div>> create a single thread pool for your "slow, blocking native tasks" and then just wait for the submitted task on the VT. </div><div dir="auto"><br></div><div dir="auto">Is it possible currently to make sure that the VT never run on that designated thread pool?</div><div dir="auto"><br></div><div dir="auto">On weaker systems I can imagine this causing slow downs<br><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sat, Jul 15, 2023, 00:13 Attila Kelemen <<a href="mailto:attila.kelemen85@gmail.com">attila.kelemen85@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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"><br>
If I'm writing a new service, and I have complete control over what <br>
native libraries it depends on, I might conclude that virtual threads <br>
are a good choice. But as the service evolves, I might want to start <br>
depending on native libraries that provide needed functionality. If they <br>
perform blocking operations, I might need to wrap the library with a <br>
message passing queue, which just adds overhead and complexity. If the <br>
advice is to stop using virtual threads at this point, I could have made <br>
that decision from day one. And it seems that's the safest option.<br><br></blockquote><div><br></div><div>But it is a false dichotomy to choose between not using virtual threads basically at all, and using only VTs. If that is a serious problem, then you could just create a single thread pool for your "slow, blocking native tasks" and then just wait for the submitted task on the VT. It is unlikely to make things very difficult, because you can easily hide this behind a method which is barely different from marking a method as "blocking, please compensate", and you even have more flexibility (which you might need, if you have such an edge case).</div><div> </div></div></div>
</blockquote></div></div></div>