[Twisted-Python] Watching a File Descriptor
Justin Mazzola Paluska
jmp at MIT.EDU
Sun Jan 21 10:55:54 MST 2007
Hi,
I’m playing with the inotify(7) interface on Linux. When I call
inotify_init(), I get back a file descriptor that I’m supposed read
from when there are file system events.
What’s the best way to integrate the inotify file descriptor into the
Twisted reactor? My question has two subparts:
1. How do I tell Twisted to check my fd for readability? (Is
reactor.addReader() all I need?
2. How do I register a callback to my own code when my fd is
readable?
All in all, it seems what I really want is something like
ProcessProtocol, but without spawning a process. Forgive me if I’ve
missed something obvious, but searching google and the gmane mail
archives hasn’t turned up anything.
Thanks,
—Justin
More information about the Twisted-Python
mailing list