natecraddock / zf

a commandline fuzzy finder and zig package designed for filtering filepaths
MIT License
451 stars 14 forks source link

Evented IO #40

Closed natecraddock closed 1 year ago

natecraddock commented 1 year ago

zf currently uses a blocking read loop for inputs. This keeps zf very efficient - if there is nothing to read, then zf is waiting on the kernel to wake it up. But the current implementation only waits on reading from the tty file descriptor.

I have two features I want to implement that depend on an event loop:

I'm not yet sure how I want to do this. Using kqueue / epoll directly isn't much work, so perhaps I will just roll my own. There is also a std.io.poll in the next Zig version that could work. Perhaps I will rely on a library like https://github.com/mitchellh/libxev or libuv.

natecraddock commented 1 year ago

I did a little more research on this, I think I'm going to use kqueue and epoll directly. This gives me full control, but doesn't require pulling in a library.