Generators built on virtual threads?
Pedro Lamarão
pedro.lamarao at prodist.com.br
Fri May 20 16:41:55 UTC 2022
Em sex., 20 de mai. de 2022 às 13:28, Daniel Avery <danielaveryj at gmail.com>
escreveu:
I am familiar enough with the difference in mechanism between java
> (threads) and python (continuations) that this wasn't very surprising.
>
Loom's virtual threads are in fact implemented with delimited continuations.
Currently, the Continuation class is not exposed as an API for various
reasons.
I have experimented with defining a Generator based on Continuation
directly,
but I did not advance to performance testing,
as I was mostly interested in usability.
You may find my old, not updated code below.
I put this inside a JDK fork to be able to play with Continuation without
opening internal modules.
https://github.com/pedrolamarao/jdk-loom/blob/generators/src/java.base/share/classes/java/util/generator/Generator.java
--
Pedro Lamarão
More information about the loom-dev
mailing list