diff options
Diffstat (limited to 'python3/pyinotify.py')
-rwxr-xr-x | python3/pyinotify.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/python3/pyinotify.py b/python3/pyinotify.py index a826efb..6c52708 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -1535,6 +1535,33 @@ class AsyncNotifier(asyncore.file_dispatcher, Notifier): self.process_events() +class TornadoAsyncNotifier(Notifier): + """ + Tornado ioloop adapter. + + """ + def __init__(self, watch_manager, ioloop, default_proc_fun=None, + read_freq=0, threshold=0, timeout=None, channel_map=None): + """ + See example transient_file_tornado.py + + @param ioloop: Tornado's IO loop. + @type ioloop: tornado.ioloop.IOLoop instance. + + """ + Notifier.__init__(self, watch_manager, default_proc_fun, read_freq, + threshold, timeout) + ioloop.add_handler(os.dup(self._fd), self.handle_read, ioloop.READ) + + def handle_read(self, *args, **kwargs): + """ + See comment in AsyncNotifier. + + """ + self.read_events() + self.process_events() + + class Watch: """ Represent a watch, i.e. a file or directory being watched. |