-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dedicated io scheduler and macOS kqueue support
fix: clear poll before waiting feat: move io to separate thread feat: broaden io ops types to fd fix: include poll as a dep and fmt try: poll with short timeout feat: reuse buffer on the receiver end chore: remove poll_idx fix: if no open fds to wait for, don't wait
- Loading branch information
Showing
15 changed files
with
234 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(library | ||
(package riot) | ||
(name net) | ||
(libraries core util log iomux uri unix telemetry bigstringaf)) | ||
(libraries core util log poll uri unix telemetry bigstringaf)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <caml/mlvalues.h> | ||
#include <caml/memory.h> | ||
#include <caml/alloc.h> | ||
#include <caml/fail.h> | ||
#include <caml/bigarray.h> | ||
#include <sys/uio.h> | ||
#include <unistd.h> | ||
|
||
CAMLprim value riot_unix_readv(value fd, value iovs, value count) { | ||
CAMLparam3(fd, iovs, count); | ||
|
||
size_t len = Int_val(count); | ||
struct iovec c_iovs[len]; | ||
|
||
for (int i = 0; i < len; i++) { | ||
value iov = Field(iovs, i); | ||
c_iovs[i].iov_base = Caml_ba_data_val(Field(iov, 0)); | ||
c_iovs[i].iov_len = Int_val(Field(iov, 1)); | ||
} | ||
|
||
size_t ret = readv(Int_val(fd), c_iovs, len); | ||
if (ret == -1) caml_failwith("readv failed"); | ||
|
||
CAMLreturn(Val_long(ret)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <caml/mlvalues.h> | ||
#include <caml/memory.h> | ||
#include <caml/alloc.h> | ||
#include <caml/fail.h> | ||
#include <caml/bigarray.h> | ||
#include <sys/uio.h> | ||
#include <unistd.h> | ||
|
||
CAMLprim value riot_unix_writev(value fd, value iovs, value count) { | ||
CAMLparam3(fd, iovs, count); | ||
|
||
size_t len = Int_val(count); | ||
struct iovec c_iovs[len]; | ||
|
||
for (int i = 0; i < len; i++) { | ||
value iov = Field(iovs, i); | ||
c_iovs[i].iov_base = Caml_ba_data_val(Field(iov, 0)); | ||
c_iovs[i].iov_len = Int_val(Field(iov, 1)); | ||
} | ||
|
||
size_t ret = writev(Int_val(fd), c_iovs, len); | ||
if (ret == -1) caml_failwith("writev failed"); | ||
|
||
CAMLreturn(Val_long(ret)); | ||
} |
Oops, something went wrong.