File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,20 @@ object EventLoop {
9
9
// Schedule loop execution after main ends
10
10
scalanative.runtime.ExecutionContext .global.execute(
11
11
new Runnable {
12
+ /**
13
+ * This is the implementation of the event loop
14
+ * that integrates with libuv. The logic is the
15
+ * following:
16
+ * - First we run all Scala futures in the default
17
+ * execution context
18
+ * - Then in loop:
19
+ * - we check if they generated IO calls on
20
+ * the event loop
21
+ * - If it's the case we run libuv's event loop
22
+ * using UV_RUN_ONCE that blocks only once
23
+ * - We run the default execution context again
24
+ * in case the callbacks generated new Futures
25
+ */
12
26
def run (): Unit = {
13
27
scala.scalanative.runtime.loop()
14
28
while (uv_loop_alive(loop) != 0 ) {
You can’t perform that action at this time.
0 commit comments