本文整理汇总了Python中twisted.internet.posixbase.PosixReactorBase类的典型用法代码示例。如果您正苦于以下问题:Python PosixReactorBase类的具体用法?Python PosixReactorBase怎么用?Python PosixReactorBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PosixReactorBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, app=None):
self._reads = {}
self._writes = {}
if app is None:
app = QApplication([])
self.qApp = app
PosixReactorBase.__init__(self)
self.addSystemEventTrigger('after', 'shutdown', self.cleanup)
开发者ID:D3f0,项目名称:qt4-twisted,代码行数:8,代码来源:qt4reactor.py
示例2: __init__
def __init__(self, io_loop=None):
if not io_loop:
io_loop = tornado.ioloop.IOLoop.instance()
self._io_loop = io_loop
self._readers = {}
self._writers = {}
self._fds = {} # a map of fd to a (reader, writer) tuple
self._delayedCalls = {}
self._running = False
self._closed = False
PosixReactorBase.__init__(self)
开发者ID:mathphreak,项目名称:curtains,代码行数:11,代码来源:twisted.py
示例3: crash
def crash(self):
"""
Implement L{IReactorCore.crash}
"""
wasStarted = self._started
PosixReactorBase.crash(self)
if self._inCFLoop:
self._stopNow()
else:
if wasStarted:
self.callLater(0, self._stopNow)
开发者ID:BarnetteME1,项目名称:indeed_scraper,代码行数:11,代码来源:cfreactor.py
示例4: __init__
def __init__(self, runLoop=None, runner=None):
self._fdmap = {}
self._idmap = {}
if runner is None:
runner = CFRunLoopRun
self._runner = runner
if runLoop is None:
runLoop = CFRunLoopGetMain()
self._cfrunloop = runLoop
PosixReactorBase.__init__(self)
开发者ID:BarnetteME1,项目名称:indeed_scraper,代码行数:11,代码来源:cfreactor.py
示例5: crash
def crash(self):
if not self._running:
return
self._running = False
PosixReactorBase.crash(self)
self.runUntilCurrent()
try:
self._io_loop.stop()
self._io_loop.close()
except:
# Ignore any exceptions thrown by IOLoop
pass
self._closed = True
开发者ID:mathphreak,项目名称:curtains,代码行数:13,代码来源:twisted.py
示例6: __init__
def __init__(self):
"""Initialize reactor and local fd storage."""
# These inits really ought to be before
# L{PosixReactorBase.__init__} call, because it adds the
# waker in the process
self._reads = {}
self._writes = {}
self._selectables = {}
self._signal_handlers = []
from syncless import coio
self._wakeup_info = coio.wakeup_info()
self._pending_events = self._wakeup_info.pending_events
PosixReactorBase.__init__(self)
开发者ID:breezechen,项目名称:syncless,代码行数:13,代码来源:reactor.py
示例7: stop
def stop(self):
"""
Implement L{IReactorCore.stop}.
"""
self._running = False
PosixReactorBase.stop(self)
self.runUntilCurrent()
try:
self._io_loop.stop()
self._io_loop.close()
except:
# Ignore any exceptions thrown by IOLoop
pass
self._closed = True
开发者ID:mathphreak,项目名称:curtains,代码行数:14,代码来源:twisted.py
示例8: __init__
def __init__(self):
self._reads = {}
self._writes = {}
self._timer = QTimer()
self._timer.setSingleShot(True)
if QCoreApplication.startingUp():
self.qApp = QCoreApplication([])
self._ownApp = True
else:
self.qApp = QCoreApplication.instance()
self._ownApp = False
self._blockApp = None
self._readWriteQ = []
PosixReactorBase.__init__(self)
开发者ID:Pesa,项目名称:forse,代码行数:14,代码来源:qt4reactor.py
示例9: __init__
def __init__(self):
self._reads = {}
self._writes = {}
self.savedTimeout = None
self._timer = eTimer()
self._timer.callback.append(self.simulate)
self._insimulate = False
self._wakeupPending = False
# to limit the systemcalls per loop
# twistes gets a cached monotonic time for internal timers
# only updated once per loop (monotonic_time call in def simulate)
PosixReactorBase.seconds = self.now
PosixReactorBase.__init__(self)
self.addSystemEventTrigger('after', 'shutdown', self.cleanup)
开发者ID:st7TEAM,项目名称:dreambox,代码行数:14,代码来源:e2reactor.py
示例10: __init__
def __init__(self):
QObject.__init__(self)
self._readers = {}
self._writers = {}
self._timer = QTimer()
self._timer.setSingleShot(True)
self.connect(self._timer, SIGNAL("timeout()"), self._timerSlot)
self._eventLoop = QCoreApplication.instance()
if self._eventLoop is None:
# create dummy application for testing
self._eventLoop = QCoreApplication([])
PosixReactorBase.__init__(self) # goes last, because it calls addReader
开发者ID:nnemkin,项目名称:deluge_qt,代码行数:15,代码来源:qt4reactor.py
示例11: __init__
def __init__(self):
self._loop = pyuv.Loop()
self._async_handle = pyuv.Async(self._loop, self._async_cb)
self._async_handle_lock = threading.Lock()
self._async_callbacks = deque()
self._readers = {} # map of reader objects to fd
self._writers = {} # map of writer objects to fd
self._fds = {} # map of fd to a (reader, writer) tuple
self._delayedCalls = {}
self._poll_handles = {}
self._signal_fds = SocketPair()
self._signal_checker = pyuv.util.SignalChecker(self._loop, self._signal_fds.reader_fileno())
self._signal_checker.unref()
self._signal_checker.start()
PosixReactorBase.__init__(self)
开发者ID:cyisfor,项目名称:twisted-pyuv,代码行数:15,代码来源:__init__.py
示例12: __init__
def __init__(self):
self._io_loop = tornado.ioloop.IOLoop.current()
self._readers = {} # map of reader objects to fd
self._writers = {} # map of writer objects to fd
self._fds = {} # a map of fd to a (reader, writer) tuple
self._delayedCalls = {}
PosixReactorBase.__init__(self)
self.addSystemEventTrigger('during', 'shutdown', self.crash)
# IOLoop.start() bypasses some of the reactor initialization.
# Fire off the necessary events if they weren't already triggered
# by reactor.run().
def start_if_necessary():
if not self._started:
self.fireSystemEvent('startup')
self._io_loop.add_callback(start_if_necessary)
开发者ID:JZQT,项目名称:tornado,代码行数:16,代码来源:twisted.py
示例13: __init__
def __init__(self, io_loop=None):
if not io_loop:
io_loop = tornado.ioloop.IOLoop.instance()
self._io_loop = io_loop
self._readers = {} # map of reader objects to fd
self._writers = {} # map of writer objects to fd
self._fds = {} # a map of fd to a (reader, writer) tuple
self._delayedCalls = {}
PosixReactorBase.__init__(self)
# IOLoop.start() bypasses some of the reactor initialization.
# Fire off the necessary events if they weren't already triggered
# by reactor.run().
def start_if_necessary():
if not self._started:
self.fireSystemEvent("startup")
self._io_loop.add_callback(start_if_necessary)
开发者ID:AM7000000,项目名称:TornadoOSCWSStream,代码行数:18,代码来源:twisted.py
示例14: __init__
def __init__(self):
self._reads = {}
self._writes = {}
self._timer=QTimer()
self._timer.setSingleShot(True)
if QCoreApplication.startingUp():
self.qApp=QCoreApplication([])
self._ownApp=True
else:
self.qApp = QCoreApplication.instance()
self._ownApp=False
self._blockApp = None
self._readWriteQ=[]
""" some debugging instrumentation """
self._doSomethingCount=0
PosixReactorBase.__init__(self)
开发者ID:AlickHill,项目名称:Lantern,代码行数:18,代码来源:qt4reactor.py
示例15: callLater
def callLater(self, _seconds, _f, *args, **kw):
"""
Implement L{IReactorTime.callLater}.
"""
delayedCall = PosixReactorBase.callLater(
self, _seconds, _f, *args, **kw
)
self._scheduleSimulate()
return delayedCall
开发者ID:BarnetteME1,项目名称:indeed_scraper,代码行数:9,代码来源:cfreactor.py
示例16: _moveCallLaterSooner
def _moveCallLaterSooner(self, tple):
"""
Override L{PosixReactorBase}'s implementation of L{IDelayedCall.reset}
so that it will immediately reschedule. Normally
C{_moveCallLaterSooner} depends on the fact that C{runUntilCurrent} is
always run before the mainloop goes back to sleep, so this forces it to
immediately recompute how long the loop needs to stay asleep.
"""
result = PosixReactorBase._moveCallLaterSooner(self, tple)
self._scheduleSimulate()
return result
开发者ID:BarnetteME1,项目名称:indeed_scraper,代码行数:11,代码来源:cfreactor.py
示例17: __init__
def __init__(self, io_loop=None):
if not io_loop:
io_loop = tornado.ioloop.IOLoop.instance()
self._io_loop = io_loop
self._readers = {} # map of reader objects to fd
self._writers = {} # map of writer objects to fd
self._fds = {} # a map of fd to a (reader, writer) tuple
self._delayedCalls = {}
PosixReactorBase.__init__(self)
# The default is a ThreadedResolver which spawns worker threads
# from a thread pool which is probably *correct* but was quite
# confusing and inconsistent with default Tornado behavior.
self.installResolver(BlockingResolver())
self.addSystemEventTrigger('during', 'shutdown', self.crash)
# IOLoop.start() bypasses some of the reactor initialization.
# Fire off the necessary events if they weren't already triggered
# by reactor.run().
def start_if_necessary():
if not self._started:
self.fireSystemEvent('startup')
self._io_loop.add_callback(start_if_necessary)
开发者ID:swimorsink,项目名称:tornado,代码行数:22,代码来源:twisted.py
示例18: crash
def crash(self):
PosixReactorBase.crash(self)
self._io_loop.stop()
开发者ID:756613351,项目名称:tornado,代码行数:3,代码来源:twisted.py
示例19: stop
def stop(self):
PosixReactorBase.stop(self)
fire_shutdown = functools.partial(self.fireSystemEvent, "shutdown")
self._io_loop.add_callback(fire_shutdown)
开发者ID:756613351,项目名称:tornado,代码行数:4,代码来源:twisted.py
示例20: callLater
def callLater(self, _seconds, _f, *args, **kw):
ret = PosixReactorBase.callLater(self, _seconds, _f, *args, **kw)
if not self._wakeupPending:
self.wakeUp()
self._wakeupPending = True
return ret
开发者ID:st7TEAM,项目名称:dreambox,代码行数:6,代码来源:e2reactor.py
注:本文中的twisted.internet.posixbase.PosixReactorBase类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论