def queue_events(self, timeout):
        """
        Queues events by reading them from a call to the blocking
        :meth:`select.kqueue.control()` method.

        :param timeout:
            Blocking timeout for reading events.
        :type timeout:
            ``float`` (seconds)
        """
        with self._lock:
            try:
                event_list = self._read_events(timeout)
                files_renamed, dirs_renamed, dirs_modified = (
                    self._queue_events_except_renames_and_dir_modifications(event_list))

                # Take a fresh snapshot of the directory and update the
                # saved snapshot.
                new_snapshot = DirectorySnapshot(self.watch.path,
                                                 self.watch.is_recursive)
                ref_snapshot = self._snapshot
                self._snapshot = new_snapshot

                if files_renamed or dirs_renamed or dirs_modified:
                    for src_path in files_renamed:
                        self._queue_renamed(src_path,
                                            False,
                                            ref_snapshot,
                                            new_snapshot)
                    for src_path in dirs_renamed:
                        self._queue_renamed(src_path,
                                            True,
                                            ref_snapshot,
                                            new_snapshot)
                    self._queue_dirs_modified(dirs_modified,
                                              ref_snapshot,
                                              new_snapshot)
            except __HOLE__ as e:
                if e.errno == errno.EBADF:
                    # logging.debug(e)
                    pass
                else:
                    raise
dataset/ETHPy150Open yildizberkay/MongoApp/libs/watchdog/observers/kqueue.py/KqueueEmitter.queue_events