Exemplo n.º 1
0
 def run(self):
     pool = AppKit.NSAutoreleasePool.alloc().init()
     self._run_loop = CFRunLoopGetCurrent()
     FSEventStreamScheduleWithRunLoop(self._stream_ref, self._run_loop,
                                      kCFRunLoopDefaultMode)
     if not FSEventStreamStart(self._stream_ref):
         FSEventStreamInvalidate(self._stream_ref)
         FSEventStreamRelease(self._stream_ref)
         raise IOError('FSEvents. Could not start stream.')
     CFRunLoopRun()
     FSEventStreamStop(self._stream_ref)
     FSEventStreamInvalidate(self._stream_ref)
     FSEventStreamRelease(self._stream_ref)
     del pool
     self._queue.put(None)
Exemplo n.º 2
0
    def __remove_dir(self, path):
        """override of FSMonitor.__remove_dir()"""
        if path in self.monitored_paths.keys():
            streamRef = self.monitored_paths[path].fsmonitor_ref
            # Stop, unschedule, invalidate and release the stream refs.
            FSEventStreamStop(streamRef)
            # We don't use FSEventStreamUnscheduleFromRunLoop prior to
            # invalidating the stream, because invalidating the stream
            # automatically unschedules the stream from all run loops.
            FSEventStreamInvalidate(streamRef)
            FSEventStreamRelease(streamRef)

            del self.monitored_paths[path]