PyKQueue


What is PyKQueue?

PyKQueue is a Python module that provides an object-oriented interface to the FreeBSD syscalls kqueue(2) and kevent(2).

The kqueue system provides a more robust and less compute-intensive way to monitor system and file events. Instead of slinging huge arrays as needed with select(2), kevent(2) takes a list of KEvents to monitor, and keeps watching them until they're explicitly deleted -- no need to keep passing in the same objects over and over again. This methodology promotes the construction of large asynchronous frameworks, such as the one used in the asyncore Python module.

Where can I get PyKQueue?

The current version is 1.2, available at

ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/dwhite/

How do I use PyKQueue?

PyKQueue provides fairly direct access to the kqueue and kevent calls, so reading the kqueue(2) and kevent(2) manpages is a must.

You will want to import all the symbols from the KQueue module to make accessing the functions easier: use 'from KQueue import *' in the beginning of your Python program.

The available constructors are:

The available methods of a KQueue are:

What if I have suggestions or improvements for PyKQueue?

Please email them to dwhite@freebsd.org.