-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Libuv #384
base: dev
Are you sure you want to change the base?
Libuv #384
Conversation
1a9587a
to
5e97fe9
Compare
8358743
to
c2905c2
Compare
8c2d1a2
to
c7258ce
Compare
9b9450c
to
7705130
Compare
97529c3
to
f217dc2
Compare
lib/std/core.kk
Outdated
@@ -72,6 +72,12 @@ pub alias io-total = <ndet,console,net,fsys,ui,st<global>> | |||
// The `:io-noexn` effect is used for functions that perform arbitrary I/O operations, but raise no exceptions | |||
pub alias io-noexn = <div,io-total> | |||
|
|||
// The `:event-loop` effect signifies that a function requires an initialized event loop | |||
pub type event-loop :: X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is one major change. Adding event loop to the core effects.
The async library requires that there be an event loop around it, or at the very least a timer that can call callbacks.
In principle we could just use an implicit parameter for the handler for the async effect, to get the event loop and wrap it.
The problem with that approach is that if you use any libuv apis directly in callback style without the async library then you have to manually remember to initialize the event loop.
We could in principle make a custom error and detect uninitialized event loops at runtime, but that would introduce runtime overhead for each libuv call that uses callbacks, so I opted to create this new effect instead.
I will note that I did use the implicit parameter approach for the timer requirements of the async lib so that in principle you can swap out the libuv library for some other event loop library.
ddc9572
to
9b2c2b0
Compare
Implemented: (Low Level, Callback, LibUV wrapper)
Streams
File I/O
Net / TCP I/O
Timer
FS Poll
FS Event
Signals
TTY
Implemented: Async API
Basic File I/O
Basic TCP I/O
Timer (Also implemented for js and wasm)
Implemented: llhttp parser
Missing LibUV: UDP, Threading, Process, uv async channels, Prepare/Check/Idle
Missing (external libraries): SSL!