<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div dir="ltr"></div><div dir="ltr">ScopedValues won’t do what is needed. </div><div dir="ltr"><br><blockquote type="cite">On Oct 4, 2025, at 8:32 AM, Remi Forax <forax@univ-mlv.fr> wrote:<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"dreamlike_ocean lei" <dreamlike.vertx@gmail.com><br><b>To: </b>"loom-dev" <loom-dev@openjdk.java.net><br><b>Sent: </b>Saturday, October 4, 2025 3:19:10 PM<br><b>Subject: </b>Scheduler API Feedback<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><p>Hello @loom-dev <loom-dev at <a href="http://openjdk.org" target="_blank">openjdk.org</a>>,</p>
<p>I have been enjoying the new POLLER_PER_CARRIER design in the Loom repo and I really like the direction it is going.<br>
While building on top of the latest code, I noticed a couple of issues and would like to ask for clarification.</p>
<ol>
<li>
<p>When calling <code>Thread.startVirtualThread</code>, the new virtual thread does not inherit the scheduler of the calling virtual thread, but instead uses <code>DEFAULT_SCHEDULER</code>. What is the reasoning behind this design? Could there be a mechanism to allow implicit inheritance? This would be very helpful for custom schedulers based on the per-core model.</p></li></ol></div></blockquote><div><br></div><div>I do not know if POLLER_PER_CARRIER works that way or not,</div><div>but the preferred mechanism to get "inheritance" of values between virtual threads is to use a ScopeValue for the value and a StructuredTaskScope to organize the virtual threads. </div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><ol>
<li>
<p>The method <code>Thread.VirtualThreadScheduler::current</code> is very helpful, but it seems not quite enough. Since Loom already provides the read-only <code>builtin.externalView</code>, could we also have a method like <code>Thread.VirtualThreadScheduler::scheduler(Thread)</code>? This would make it easier to build better schedulers. For example, I could combine <code>Thread.currentThread</code> with <code>Thread.VirtualThreadScheduler.scheduler</code> to decide whether to push a task into a local task queue rather than the eventLoop’s MPSC queue.</p>
</li>
</ol>
<p>Thank you for your time and help.<br>
Best regards,<br>dreamlike li</p></div></blockquote><div><br></div><div>regards,</div><div>Rémi</div><div><br data-mce-bogus="1"></div></div></div></div></blockquote></body></html>