Ejemplo n.º 1
0
 def _fire_watches(self, paths, event, watch_source):
     for path in reversed(sorted(paths)):
         with self._open_close_lock:
             if self._connected:
                 with self._watches_lock:
                     watches = list(watch_source.pop(path, []))
                 for w in watches:
                     cb = utils.make_cb(w, [event])
                     self.handler.dispatch_callback(cb)
Ejemplo n.º 2
0
 def _fire_watches(self, paths, event, watch_source):
     for path in reversed(sorted(paths)):
         with self._open_close_lock:
             if self._connected:
                 with self._watches_lock:
                     watches = list(watch_source.pop(path, []))
                 for w in watches:
                     cb = utils.make_cb(w, [event])
                     self.handler.dispatch_callback(cb)
Ejemplo n.º 3
0
    def flush(self):
        self.verify()

        # This puts an item into the callback queue, and waits until it gets
        # called, this is a cheap way of knowing that the queue has been
        # cycled over (as this item goes in on the bottom) and only when the
        # items ahead of this callback are finished will this get called.
        wait_for = self.handler.event_object()
        fired = False

        def flip():
            wait_for.set()

        while not wait_for.is_set():
            if not fired:
                self.handler.dispatch_callback(utils.make_cb(flip))
                fired = True
            time.sleep(0.001)
Ejemplo n.º 4
0
    def flush(self):
        self.verify()

        # This puts an item into the callback queue, and waits until it gets
        # called, this is a cheap way of knowing that the queue has been
        # cycled over (as this item goes in on the bottom) and only when the
        # items ahead of this callback are finished will this get called.
        wait_for = self.handler.event_object()
        fired = False

        def flip():
            wait_for.set()

        while not wait_for.is_set():
            if not fired:
                self.handler.dispatch_callback(utils.make_cb(flip))
                fired = True
            time.sleep(0.001)
Ejemplo n.º 5
0
 def _fire_state_change(self, state):
     with self._listeners_lock:
         listeners = list(self._listeners)
     for func in listeners:
         self.handler.dispatch_callback(utils.make_cb(func, [state]))
Ejemplo n.º 6
0
 def _fire_state_change(self, state):
     with self._listeners_lock:
         listeners = list(self._listeners)
     for func in listeners:
         self.handler.dispatch_callback(utils.make_cb(func, [state]))