コード例 #1
0
ファイル: cfreactor.py プロジェクト: jsober/twisted
 def callLater(self, howlong, *args, **kwargs):
     rval = posixbase.PosixReactorBase.callLater(self, howlong, *args, **kwargs)
     if self.timer:
         timeout = self.timeout()
         if timeout is None:
             timeout = howlong
         sleepUntil = cf.now() + min(timeout, howlong)
         if sleepUntil < self.timer.getNextFireDate():
             self.timer.setNextFireDate(sleepUntil)
     else:
         pass
     return rval
コード例 #2
0
 def callLater(self, howlong, *args, **kwargs):
     rval = posixbase.PosixReactorBase.callLater(self, howlong, *args, **kwargs)
     if self.timer:
         timeout = self.timeout()
         if timeout is None:
             timeout = howlong
         sleepUntil = cf.now() + min(timeout, howlong)
         if sleepUntil < self.timer.getNextFireDate():
             self.timer.setNextFireDate(sleepUntil)
     else:
         pass
     return rval
コード例 #3
0
ファイル: cfreactor.py プロジェクト: jsober/twisted
 def simulate(self):
     if self.crashing:
         return
     if not self.running:
         raise ValueError, "You can't simulate a stopped reactor"
     if self._doRunUntilCurrent:
         self.runUntilCurrent()
     if self.crashing:
         return
     if self.timer is None:
         return
     nap = self.timeout()
     if nap is None:
         nap = self.pollInterval
     else:
         nap = min(self.pollInterval, nap)
     if self.running:
         self.timer.setNextFireDate(cf.now() + nap)
     if not self._doRunUntilCurrent:
         self.crash()
コード例 #4
0
 def simulate(self):
     if self.crashing:
         return
     if not self.running:
         raise ValueError, "You can't simulate a stopped reactor"
     if self._doRunUntilCurrent:
         self.runUntilCurrent()
     if self.crashing:
         return
     if self.timer is None:
         return
     nap = self.timeout()
     if nap is None:
         nap = self.pollInterval
     else:
         nap = min(self.pollInterval, nap)
     if self.running:
         self.timer.setNextFireDate(cf.now() + nap)
     if not self._doRunUntilCurrent:
         self.crash()
コード例 #5
0
ファイル: cfreactor.py プロジェクト: jsober/twisted
 def _startup(self):
     if self.running:
         raise ValueError, "Can't bootstrap a running reactor"
     self.timer = cf.PyCFRunLoopTimer(cf.now(), self.pollInterval, self.simulate)
     self.runLoop.addTimer(self.timer)
コード例 #6
0
 def _startup(self):
     if self.running:
         raise ValueError, "Can't bootstrap a running reactor"
     self.timer = cf.PyCFRunLoopTimer(cf.now(), self.pollInterval, self.simulate)
     self.runLoop.addTimer(self.timer)