Skip to content

Fibers on Truffle - need some pointers #2747

Answered by eregon
marad asked this question in Q&A
Discussion options

You must be logged in to vote

So currently Fibers (= Ruby's stackful coroutines) are implemented using Threads and queues in TruffleRuby, to ensure only one execute at a time (per Ruby Thread).
I'm adding an option to use VirtualThread for Fibers on JDK 19+, but Truffle does not support them well yet, only in the DefaultTruffleRuntime currently.

Regarding using them in Truffle, it's not different than using VirtualThread directly from regular Java, so I think you're mostly asking "what's the API of Loom" and that is Loom's API and that's mostly VirtualThread (e.g. docs https://download.java.net/java/early_access/loom/docs/api/java.base/java/lang/Thread.html).
There is also a lower-level Continuation (https://github.co…

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@marad
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@marad
Comment options

Answer selected by marad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2731 on September 30, 2022 13:58.