About the VirtualThread Api
何品(虎鸣)
hepin.p at alibaba-inc.com
Fri Apr 14 08:47:32 UTC 2023
Hi team, thank for roll this out:
I have a question about the current api of `VirtualThread`. The current `VirtualThread` 's constructor is `
VirtualThread(Executor scheduler, String name, int characteristics, Runnable task)
And using a
private static final ScheduledExecutorService UNPARKER = createDelayedTaskScheduler();
to do all the `unpark` of virtualThread.
What if I Want to implement a `VirturalThread` Scheduler other than the default FPJ based one?And I can even using Netty's `EventLoopGroup` to do this, And the `EventLoop` itself can do scheduling too.
There is no way for user to provide a user specified `Unparker`.
What if we change the constructor to something like:
VirtualThread(Scheduler scheduler, String name, int characteristics, Runnable task)
where Scheduler can do Scheduling and executing.
Or
VirtualThread(Executor scheduler, ScheduledExecutorService unparker, String name, int characteristics, Runnable task)
Or
VirtualThread(ScheduledExecutorService scheduler, String name, int characteristics, Runnable task)
The Tikio's Scheduler can do the scheduling and do not need another inner unparker.
And I'm would be very happy to hear you, thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230414/bb836328/attachment.htm>
More information about the loom-dev
mailing list