[ANN] kqueue-ml 0.2.0 and poll 0.1.0


I’d like to announce new releases for kqueue-ml (version 0.2.0) and an initial release of poll (version 0.1.0).

Kqueue-ml: Thin bindings to the kqueue event notification system. Changes since the last release:

  • Remove dependency on ctypes
  • Limit support to 64 bit systems
  • Adds constant values to be used as filter flags in the public API

Installation: opam install kqueue

Caveat: This is again mostly tested on macOS, but I plan to work on testing and fixing bugs for getting the library to work well on the various BSD systems, so please open issues if you use it on a BSD system and notice problems (Thanks!).

Poll: Portable OCaml interface to macOS/Linux/Windows native IO event notification mechanisms

Installation: opam install poll

This is the first release of poll, which builds on top of kqueue-ml and adds bindings to the system IO event notifications on linux and windows to provide a portable polling interface. It uses kqueue on macOS, epoll on linux, and uses wepoll on windows so it can leverage IOCP on windows instead of select. All io events will be level triggered, i.e. there will be a notification as long as the file descriptor being watched is ready to read/write.

If you experience any problems, please open an issue on the Github Issue tracker :slightly_smiling_face:


As someone working on a ctypes-based binding to some c libraries, I am curious as to why you made this decision? Could you share a little on the motivation? Are ctypes bindings too slow? or is there some other reason?

My reasons for switching away from types were mostly personal preferences. By the time I got around to updating the library, I had become more familiar with interfacing C with OCaml, and felt more comfortable writing my own bindings. I’ll most likely still reach out to ctypes if I need to write bindings for a more complicated use-case (I still use ctypes for some more involved c bindings at work), but for the simple needs of these two libraries I was happy to avoid the additional build system boilerplate and an additional dependency since it was easy to do so.

1 Like