Revision 69b99987 lib/asyncnotifier.py
b/lib/asyncnotifier.py | ||
---|---|---|
31 | 31 |
|
32 | 32 |
""" |
33 | 33 |
|
34 |
def __init__(self, watch_manager, |
|
35 |
default_proc_fun=None, |
|
36 |
map=None): |
|
37 |
""" |
|
38 |
Constructor for AsyncNotifier, a special asyncore file_dispatcher that |
|
39 |
actually wraps a pyinotify Notifier, making it asyncronous. |
|
34 |
def __init__(self, watch_manager, default_proc_fun=None, map=None): |
|
35 |
"""Initializes this class. |
|
36 |
|
|
37 |
This is a a special asyncore file_dispatcher that actually wraps a |
|
38 |
pyinotify Notifier, making it asyncronous. |
|
40 | 39 |
|
41 | 40 |
""" |
42 | 41 |
if default_proc_fun is None: |
43 |
default_proc_fun=pyinotify.ProcessEvent() |
|
42 |
default_proc_fun = pyinotify.ProcessEvent() |
|
43 |
|
|
44 | 44 |
self.notifier = pyinotify.Notifier(watch_manager, default_proc_fun) |
45 |
|
|
45 | 46 |
# here we need to steal the file descriptor from the notifier, so we can |
46 | 47 |
# use it in the global asyncore select, and avoid calling the |
47 | 48 |
# check_events() function of the notifier (which doesn't allow us to select |
... | ... | |
52 | 53 |
def handle_read(self): |
53 | 54 |
self.notifier.read_events() |
54 | 55 |
self.notifier.process_events() |
55 |
|
Also available in: Unified diff