Skip to content

Commit a05f3bb

Browse files
Richard WhalingRichard Whaling
authored andcommitted
added LoopExtension docs
1 parent 41d96b6 commit a05f3bb

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# native-loop
1+
# native-loop (PRE-RELEASE)
22
Extensible event loop and async-oriented IO for Scala Native; powered by libuv.
33

44
Shameless plug: code mostly adapted from my book, [Modern Systems Programming in Scala Native](https://pragprog.com/book/rwscala/modern-systems-programming-with-scala-native)
@@ -23,6 +23,20 @@ That said - providing a full-featured ecosystem in a single library isn't feasib
2323

2424
To demonstrate the architectural style of a full, extensible async ecosystem for Scala Native, with an idiomatic Future-based API, implemented entirely as a library, and to start discussion about what we our priorities are.
2525

26+
## LoopExtension trait
27+
28+
To attach a new library to the event loop, all we need to do is provide the `LoopExtension` trait:
29+
30+
```
31+
trait LoopExtension {
32+
def activeRequests:Int
33+
}
34+
```
35+
36+
And then register the component at runtime with `EventLoop.addExtension()`.
37+
38+
This is necessary because we need some way to know if there are pending IO tasks being managed by a C library, even if there are no outstanding Futures, and prevent the event loop from shutting down prematurely in that case.
39+
2640
## Maintenance Status
2741

2842
This code is a pre-release preview - I am cleaning up both the style and the implementation,

0 commit comments

Comments
 (0)