Commits

Bryan O'Sullivan  committed 237239b

Add readable() method.

  • Participants
  • Parent commits 85ce7cc

Comments (0)

Files changed (1)

File inotify/watcher.py

         self.threshold = threshold
         self._iocbuf = array.array('i', [0])
 
+    def readable(self):
+        fcntl.ioctl(self.fd, termios.FIONREAD, self._iocbuf, True)
+        return self._iocbuf[0]
+
     def __call__(self):
-        fcntl.ioctl(self.fd, termios.FIONREAD, self._iocbuf, True)
-        return self._iocbuf[0] >= threshold
+        return self.readable() >= self.threshold