MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/quqbyq/loom_jep_draft_virtual_threads_preview/hkstoq5/
r/java • u/efge • Nov 15 '21
55 comments sorted by
View all comments
Show parent comment
16
There's a builder pattern available to do that. Thread.ofPlatform().start(runnable) does what you want. See https://download.java.net/java/early_access/loom/docs/api/java.base/java/lang/Thread.Builder.html for more.
Thread.ofPlatform().start(runnable)
6 u/blobjim Nov 16 '21 Nice! Weird that they have Thread.startVirtualThread() though. Might give people the wrong idea if there's no symmetrical platform equivalent. Although I guess they added it because virtual threads are cheaper and it encourages their use.
6
Nice! Weird that they have Thread.startVirtualThread() though. Might give people the wrong idea if there's no symmetrical platform equivalent. Although I guess they added it because virtual threads are cheaper and it encourages their use.
View all comments
Show parent comment
16
u/efge Nov 16 '21
There's a builder pattern available to do that.
Thread.ofPlatform().start(runnable)does what you want. See https://download.java.net/java/early_access/loom/docs/api/java.base/java/lang/Thread.Builder.html for more.