Пример #1
0
    def do_run(self):
        trellis.change_attr(self, '_scheduled', False)
        ctrl = trellis.ctrl
        ctrl.current_listener = self
        try:
            try:
                self._step()
                # process writes as if from a non-rule perspective
                writes = ctrl.writes
                has_run = ctrl.has_run.get
                while writes:
                    subject, writer = writes.popitem()
                    for dependent in subject.iter_listeners():
                        if has_run(dependent) is not self:
                            if dependent.dirty():
                                ctrl.schedule(dependent)

                # process reads in normal fashion
                ctrl._process_reads(self)

            except:
                ctrl.reads.clear()
                ctrl.writes.clear()
                raise           
        finally:
            ctrl.current_listener = None
Пример #2
0
 def dirty(self):
     if not self._scheduled:
         trellis.change_attr(self, '_scheduled', True)
         trellis.on_commit(self._loop.call, trellis.atomically, self.do_run)
     return False
Пример #3
0
 def _set(self, when):
     trellis.change_attr(self, '_now', when)
     self._tick = when