For my PhD thesis I’m working on event based control systems. Asynchronous I/O is needed, and so I rely on epoll(), a notification mechanism for file descriptors in Linux systems. As (nearly) everything in Linux can be described as a file, epoll() is able to monitor various I/O interfaces like GPIO or network sockets. It’s simple: let epoll.poll() block until something happens.
Well, then I thought about time-driven control systems, using timers to schedule events. To fit these timers into my epoll asynchronous I/O system I needed a timer that notifies its expiration via a file object.
And so I discovered a library named “timerfd”, available in Linux since kernel 2.6.25. It provides three system calls to create and manage such timers. Simple to use inside a C program. But my Python-based prototype system required a Python binding.
I couldn’t find a “timerfd” module and therefore started to write my own extension. It is now available at the Python Package Index: https://pypi.python.org/pypi/pytimerfd/1.0