Unix offers two system calls, select() and poll(), which accept a list of file descriptors, block until one of the set is ready for I/O, and return a list of the ready file descriptors. The time to execute these calls is proportional to the number of file descriptors, which means they become inefficient above a couple thousand file descriptors.

Various implementations of Unix offer high-performance, scalable replacements for these system calls, e.g. /dev/poll, kqueue(), /dev/epoll, and Linux's realtime signal readiness notification, all with significantly different interfaces. This makes them difficult to learn, and makes it hard to write portable code.

Poller is an interface that provides a common abstraction for all of these readiness notification schemes. New readiness notification schemes can be supported by writing a new subclass of Poller.

Poller is currently supplied as part of dkftpbench. To use it, download, unpack, configure, make, and install dkftpbench as usual (this takes about two minutes).

In source that create Pollers, you currently need to include each of the subclasses you want to use, e.g. to get them all, you'd say

#include <dkftpbench/Poller_devpoll.h>
#include <dkftpbench/Poller_kqueue.h>
#include <dkftpbench/Poller_poll.h>
#include <dkftpbench/Poller_select.h>
#include <dkftpbench/Poller_sigfd.h>
#include <dkftpbench/Poller_sigio.h>
Source that just uses references to already-created Pollers can simply include the base class:
#include <dkftpbench/Poller.h>
Then link with -lPoller.

Three programs that use Poller might be useful as examples:

I will provide Poller in a cleaner distribution sometime, when I get a chance...

Last change: 28 Feb 2002
Copyright 2002 Dan Kegel
[Return to kegel.com]