-
Notifications
You must be signed in to change notification settings - Fork 24
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
Direct IO which is asynchronous #553
Conversation
eb73415
to
9bde62c
Compare
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.
In general I like the direction of this PR, a lot.
Could you please:
- rebase it (this will get rid of the additional
control
flag on externs in lifted, you can delete that again, since we don't plan on supporting the other backends any longer) - automatically insert a call to
eventloop
ifmain
containscontrol
? - check indentation (tabs are used in C files quite a lot)
In general, we need to decide which functions should be hidden behind namespaces like direct
and promises
and which don't.
Can you showcase somewhere how to recover the callback-based version, based on the direct-style one? I think a test or something to document it would be great.
char* path_str = c_buffer_as_null_terminated_string(path); | ||
erasePositive((struct Pos) path); | ||
|
||
// Convert the Effekt String representing the opening mode to libuv flags |
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.
// Convert the Effekt String representing the opening mode to libuv flags | |
// Convert the Effekt Mode-Datatype representing the opening mode to libuv flags |
libraries/llvm/io.c
Outdated
request->data = stack; | ||
|
||
uv_fs_open(uv_default_loop(), request, path_str, flags, 0666, c_resume_int_fs); | ||
// TODO report result (UV_EINVAL) |
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.
Do we need to free stuff when this errors? This probably means the continuation is never called and also needs to be ref-count-decremented.
703ddee
to
31af30d
Compare
31af30d
to
81c7888
Compare
char* bytes = c_buffer_bytes(buffer); // libuv expects signed integers | ||
uv_buf_t buf = uv_buf_init(bytes, c_buffer_length(buffer)); | ||
// erasePositive(buffer); | ||
// TODO we should erase the buffer but abort if this was the last reference |
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.
You mean: decrement the RC but don't free?
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.
This requires rethinking of the whole bytes/buffer/string story. Postponing.
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.
Postponed solution:
a)
- allocate a user-defined struct
Stack x Buffer
- erase in the continuation / callback
b)
- erase here, but make sure that it is USED on the Effekt side.
Please delete / fix all occurrences of |
5b84967
to
b1442a5
Compare
b1442a5
to
4798f5e
Compare
Thanks, this is a huge step forward! |
TODO
io/console.effekt
io/console.effekt
io/network.effekt
io/network.effekt
io/files.effekt
toio/filesystem.effekt
run_Pos
torunPositive
etc.uv_fs_open
etc.