mirror of
https://github.com/janet-lang/janet
synced 2024-09-28 15:08:40 +00:00
kqueue mirror master branch implementation a bit better.
This commit is contained in:
parent
1418ada38f
commit
3905e92965
@ -1658,11 +1658,12 @@ static void timestamp2timespec(struct timespec *t, JanetTimestamp ts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void janet_register_stream(JanetStream *stream) {
|
void janet_register_stream(JanetStream *stream) {
|
||||||
struct kevent kev;
|
struct kevent kevs[2];
|
||||||
EV_SETx(&kev, stream->handle, EVFILT_READ | EVFILT_WRITE, EV_ADD | EV_ENABLE | EV_CLEAR | EV_EOF, 0, 0, stream);
|
EV_SETx(&kevs[1], stream->handle, EVFILT_READ, EV_ADD | EV_ENABLE | EV_CLEAR | EV_EOF, 0, 0, stream);
|
||||||
|
EV_SETx(&kevs[1], stream->handle, EVFILT_WRITE, EV_ADD | EV_ENABLE | EV_CLEAR | EV_EOF, 0, 0, stream);
|
||||||
int status;
|
int status;
|
||||||
do {
|
do {
|
||||||
status = kevent(janet_vm.kq, &kev, 1, NULL, 0, NULL);
|
status = kevent(janet_vm.kq, kevs, 2, NULL, 0, NULL);
|
||||||
} while (status == -1 && errno != EINTR);
|
} while (status == -1 && errno != EINTR);
|
||||||
if (status == -1) {
|
if (status == -1) {
|
||||||
janet_panicv(janet_ev_lasterr());
|
janet_panicv(janet_ev_lasterr());
|
||||||
|
Loading…
Reference in New Issue
Block a user