mitchellh / libxev

libxev is a cross-platform, high-performance event loop that provides abstractions for non-blocking IO, timers, events, and more and works on Linux (io_uring or epoll), macOS (kqueue), and Wasm + WASI. Available as both a Zig and C API.
MIT License
2.07k stars 74 forks source link

watcher/async: drain mach port on notify #25

Closed mitchellh closed 1 year ago

mitchellh commented 1 year ago

We must drain the mach port when we are notified that there is data available on the port. We specify MACH_RCV_MSG for kqueue but this only drains the first message and leaves others queued. That is reasonable behavior! But, it is not the behavior we want.

kqueue doesn't appear to have a flag to do this so we do it manually.

Fixes #24