I know pyinotify.Notifier.check_events(self, timeout=None)
can take a timeout - but I'd prefer it poll indefinitely. Is it possible to interrupt it?
I am calling Notifier.stop(self)
, but it does not seem to be escaping from check_events
.
In the below example, another thread calls stopIt()
, and self.notifier.stop()
is called - but neither "check_events is True" nor "check_events is False" is printed:
def run(self):
self.notifier = pyinotify.Notifier(self.monitor, MyProcessing(self))
while True:
self.notifier.process_events()
print "Waiting at check_events"
if self.notifier.check_events():
print "check_events is True"
self.notifier.read_events()
else:
print "check_events is False"
print "Out of while"
return True
def stopIt(self):
self.notifier.stop()