Why to use inotify-cxx
inotify-cxx encapsulates inotify syscalls into a few C++ object classes. There are many reasons why to use inotify-cxx instead of the raw inotify (although inotify-cxx has certain overhead).
- simple use - You can work with object classes not with low level data such as file descriptors, raw event buffers and so on.
- exception-based error handling - All errors are reported by throwing an exception which simplifies error handling and logging.
- direct access to inotify parameters - The normal way how to get and set inotify parameters is to use procfs files (or sysctl(), but this way is obsolete). inotify-cxx provides direct access to these parameters through static object methods.
- user-space queues - In addition to the inotify kernel queues, inotify-cxx provides its own queues inside the Inotify class. These user-space queues have unlimited size and (unlike the kernel queues) don't waste physical memory (they can be eventually swapped out).
- planned: recursive watches - Because inotify itself can't monitor directories recursively (whole subtrees) it will be implemented at the application level (inside inotify-cxx). It's planned to be added in future versions.