mirror of
https://github.com/janet-lang/janet
synced 2024-12-23 23:10:26 +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) {
|
||||
struct kevent kev;
|
||||
EV_SETx(&kev, stream->handle, EVFILT_READ | EVFILT_WRITE, EV_ADD | EV_ENABLE | EV_CLEAR | EV_EOF, 0, 0, stream);
|
||||
struct kevent kevs[2];
|
||||
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;
|
||||
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);
|
||||
if (status == -1) {
|
||||
janet_panicv(janet_ev_lasterr());
|
||||
|
Loading…
Reference in New Issue
Block a user