Event loop implementation?
See original GitHub issueThis has come up at least a couple times in different contexts and I think this would be a cool idea with some interesting applications. Plus @keynmol may have volunteered himself to take this on 😉
Why:
- JVM:
IO#unsafeRunSync
in single-threaded environments (e.g. AWS lambda) without the penalty of creating threads or shifting. - JS:
unsafeRunSync
(!!) via a new “TemporalSyncIO
” data type that implementsTemporal
andSync
. @djspiewak pointed out this would be similar to the microtask loop (with the addition of timers). - Native: when Native rolls around, IIUC this should give us a single-threaded runtime essentially for free.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Explaining event loop in 100 lines of code - iximiuz
In the article, I'll try to describe the idea of the event loop in general, not a specific implementation of the event loop...
Read more >The event loop - JavaScript - MDN Web Docs - Mozilla
JavaScript has a runtime model based on an event loop, which is responsible for executing the code, collecting and processing events, ...
Read more >Event Loop — Python 3.11.1 documentation
The event loop is the core of every asyncio application. Event loops run asynchronous tasks and callbacks, perform network IO operations, and run...
Read more >How would you implement a basic event-loop? - Stack Overflow
First we need a thread safe queue which allow multiple producers and at least a single consumer (the EventLoop thread). The EventLoop object ......
Read more >A Visual Explanation of JavaScript Event Loop
In this tutorial, you will learn about the event loop in JavaScript and how JavaScript achieves the concurrency model based on the event...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ritschwumm actually it seems like it is already possible to run tasks on the AWT event dispatch thread without any changes in CE.
I see there is a method
SwingUtilities.doLater
that causes aRunnable
“to be executed asynchronously on the AWT event dispatching thread.”So all you need is something like:
Since the main thread is special, it requires the changes proposed in https://github.com/typelevel/cats-effect/pull/2732.
@bilki it’s not just the main thread, with e.g. AWT (and by extension, swing) you sometimes need to run things synchronously in the event dispatch thread