You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
After 1.0, I'd like to implement threads in all targets including single-threaded, event-loop-based, asynchronous targets. This is not going to implement soon, to avoid making noise to other things that are more important like supporting java8 and java9, and implementing all the API (except complex things like awt and things like that).
The idea is to mark I/O, sleeping and synchronization methods as suspension points, with a continuation implementation (for example Thread.sleep : @JTranscAsyncMethod(target = "js", value ="setTimeout(continuation, p0);")), then rewrite each method that can produce a suspension or call a method hierarchy that could lead to a suspension, so it is converted into a while + switch loop (like it is already), but moving all local variables including state variable into a struct, so we can exit the method and resume it later. Just like does C# async, and Kotlin coroutines.
This would allow to write plain java with threads, synchronous I/O and so on, so it works on ALL targets including JS while using asynchronous APIs and a single-threaded event loop.
The text was updated successfully, but these errors were encountered:
After 1.0, I'd like to implement threads in all targets including single-threaded, event-loop-based, asynchronous targets. This is not going to implement soon, to avoid making noise to other things that are more important like supporting java8 and java9, and implementing all the API (except complex things like awt and things like that).
The idea is to mark I/O, sleeping and synchronization methods as suspension points, with a continuation implementation (for example
Thread.sleep
:@JTranscAsyncMethod(target = "js", value ="setTimeout(continuation, p0);")
), then rewrite each method that can produce a suspension or call a method hierarchy that could lead to a suspension, so it is converted into a while + switch loop (like it is already), but moving all local variables including state variable into a struct, so we can exit the method and resume it later. Just like does C# async, and Kotlin coroutines.This would allow to write plain java with threads, synchronous I/O and so on, so it works on ALL targets including JS while using asynchronous APIs and a single-threaded event loop.
The text was updated successfully, but these errors were encountered: