summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Martini <seb@dbzteam.org>2014-12-22 16:58:34 +0100
committerSébastien Martini <seb@dbzteam.org>2014-12-22 16:58:34 +0100
commit799285ef35036f193c953e4c0b47cc1d97c2934f (patch)
tree33f2445c1aa15787e886739400074af654a1a82c
parentaf50b62ae18605a95cfe659b62133be411794666 (diff)
parent5b8699693956fec9693330613592aa5f87892511 (diff)
downloadpyinotify-799285ef35036f193c953e4c0b47cc1d97c2934f.tar.gz
Merge pull request #88 from apenwarr/master
Allow TornadoAsyncNotifier.stop() to clean up all hanging refs.
-rwxr-xr-xpython2/pyinotify.py5
-rwxr-xr-xpython3/pyinotify.py5
2 files changed, 10 insertions, 0 deletions
diff --git a/python2/pyinotify.py b/python2/pyinotify.py
index 83f7766..13af04e 100755
--- a/python2/pyinotify.py
+++ b/python2/pyinotify.py
@@ -1447,6 +1447,7 @@ class Notifier:
"""
self._pollobj.unregister(self._fd)
os.close(self._fd)
+ self._sys_proc_fun = None
class ThreadedNotifier(threading.Thread, Notifier):
@@ -1593,6 +1594,10 @@ class TornadoAsyncNotifier(Notifier):
threshold, timeout)
ioloop.add_handler(self._fd, self.handle_read, ioloop.READ)
+ def stop(self):
+ self.io_loop.remove_handler(self._fd)
+ Notifier.stop(self)
+
def handle_read(self, *args, **kwargs):
"""
See comment in AsyncNotifier.
diff --git a/python3/pyinotify.py b/python3/pyinotify.py
index a6601c8..4f039f5 100755
--- a/python3/pyinotify.py
+++ b/python3/pyinotify.py
@@ -1437,6 +1437,7 @@ class Notifier:
"""
self._pollobj.unregister(self._fd)
os.close(self._fd)
+ self._sys_proc_fun = None
class ThreadedNotifier(threading.Thread, Notifier):
@@ -1583,6 +1584,10 @@ class TornadoAsyncNotifier(Notifier):
threshold, timeout)
ioloop.add_handler(self._fd, self.handle_read, ioloop.READ)
+ def stop(self):
+ self.io_loop.remove_handler(self._fd)
+ Notifier.stop(self)
+
def handle_read(self, *args, **kwargs):
"""
See comment in AsyncNotifier.