[Twisted-Python] Is it necessary to create a new reactor to daemonize a File Alteration Monitoring system

Tommi Virtanen tv at twistedmatrix.com
Mon Dec 19 10:24:36 EST 2005


Kaladan wrote:
> I manage to write a file system monitoring daemon based on gamin
> (http://gnome.org/~veillard/gamin/) thanks to twisted API.
> Therefore I have created a new reactor, which inherit from the
> ReactorBase. In order to use the twistd application runner I have a
> GaminService which define a simple StartService.

Creating a new reactor is a horrible way to do that.
I guess you should either

1) use get_fd(), an existing reactor and handle_events() to talk to
   gamin in a non-blocking way (and if that proves impossible, work on
   improving the gamin client side library or python bindings so that it
   becomes possible)

   (plug the result of get_fd() as a readable fd in a reactor, whenever
   it is readable, call handle_events(); the web docs don't explain if
   non-blocking add of watchers is supported or not)

OR

2) reimplement the gamin client protocol from scratch with twisted.




More information about the Twisted-Python mailing list