本文整理汇总了Python中twisted.internet.reactor.removeSystemEventTrigger函数的典型用法代码示例。如果您正苦于以下问题:Python removeSystemEventTrigger函数的具体用法?Python removeSystemEventTrigger怎么用?Python removeSystemEventTrigger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removeSystemEventTrigger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeTrigger
def removeTrigger(self, trigger):
"""
Remove a trigger by its handle from the reactor and from
C{self.triggers}.
"""
reactor.removeSystemEventTrigger(trigger)
self.triggers.remove(trigger)
示例2: shutdown
def shutdown(self):
"""Shutdown the worker thread.
"""
self._q.put(self.SHUTDOWN)
if self._shutdownTriggerId is not None:
reactor.removeSystemEventTrigger(self._shutdownTriggerId)
self._shutdownTriggerId = None
示例3: processEnded
def processEnded(self, status_object):
if self.shutdown_trigger:
reactor.removeSystemEventTrigger(self.shutdown_trigger)
self.shutdown_trigger = None
self.deferred.callback(status_object.value.exitCode)
for d in self.shutdown_deferreds:
d.callback(status_object.value.exitCode)
示例4: shutdown
def shutdown(self):
self.shutting_down = True
try:
reactor.removeSystemEventTrigger(self.shutdown_trigger)
except ValueError:
pass # We may have been called automatically at shutdown.
if self.proc:
self.proc.signalProcess("INT")
示例5: shutdown
def shutdown(self):
"""Manually stop the pool. This is only necessary from tests, as the
pool will stop itself when the reactor stops under normal
circumstances."""
if not self._stop_evt:
return # pool is already stopped
reactor.removeSystemEventTrigger(self._stop_evt)
self._stop()
示例6: close
def close(self):
"""Close all pool connections and shutdown the pool"""
if self.shutdownID:
reactor.removeSystemEventTrigger(self.shutdownID)
self.shutdownID = None
if self.startID:
reactor.removeSystemEventTrigger(self.startID)
self.startID = None
self.finalClose()
示例7: clean_up
def clean_up(failure):
if self.missing_timer is not None:
self.missing_timer.cancel()
self._substantiation_failed(failure)
if self._shutdown_callback_handle is not None:
handle = self._shutdown_callback_handle
del self._shutdown_callback_handle
reactor.removeSystemEventTrigger(handle)
return failure
示例8: insubstantiate
def insubstantiate(self, fast=False):
self._clearBuildWaitTimer()
d = self.stop_instance(fast)
if self._shutdown_callback_handle is not None:
handle = self._shutdown_callback_handle
del self._shutdown_callback_handle
reactor.removeSystemEventTrigger(handle)
self.substantiated = False
self.building.clear() # just to be sure
return d
示例9: tearDown
def tearDown(self):
"""
Remove all remaining triggers from the reactor.
"""
while self.triggers:
trigger = self.triggers.pop()
try:
reactor.removeSystemEventTrigger(trigger)
except (ValueError, KeyError):
pass
示例10: __init__
def __init__(self, dbapiName, *connargs, **connkw):
"""
Create a new instance of the connection pool.
This overridden constructor makes sure the Twisted reactor
doesn't get started in non-twisted.web-hosted environments.
"""
TimeoutConnectionPool.__init__(self, dbapiName, *connargs, **connkw)
from twisted.internet import reactor
if(self.startID):
reactor.removeSystemEventTrigger(self.startID)
示例11: _cleanThreads
def _cleanThreads(self):
reactor = self._getReactor()
if interfaces.IReactorThreads.providedBy(reactor):
reactor.suggestThreadPoolSize(0)
if getattr(reactor, "threadpool", None) is not None:
try:
reactor.removeSystemEventTrigger(reactor.threadpoolShutdownID)
except KeyError:
pass
# Remove the threadpool, and let the reactor put it back again
# later like a good boy
reactor._stopThreadPool()
示例12: stop
def stop(self):
log.msg("IRCBotPlugin stopping...")
if self.shutdown_trigger is not None:
reactor.removeSystemEventTrigger(self.shutdown_trigger)
self.stopTrying()
if self.client:
log.msg("Sending quit message")
self.client.quit("Daisy, daisy...")
# The server should disconnect us after a QUIT command, but just in
# case, terminate the connection after 5 seconds.
reactor.callLater(5, self.connector.disconnect)
示例13: insubstantiate
def insubstantiate(self, fast=False):
self.insubstantiating = True
self._clearBuildWaitTimer()
d = self.stop_instance(fast)
if self._shutdown_callback_handle is not None:
handle = self._shutdown_callback_handle
del self._shutdown_callback_handle
reactor.removeSystemEventTrigger(handle)
self.substantiated = False
self.building.clear() # just to be sure
yield d
self.insubstantiating = False
self.botmaster.maybeStartBuildsForWorker(self.name)
示例14: unmapRTP
def unmapRTP(self):
from xshtoom.nat import getMapper
if self.needSTUN is False:
return defer.succeed(None)
# Currently removing an already-fired trigger doesn't hurt,
# but this seems likely to change.
try:
reactor.removeSystemEventTrigger(self._shutdownHook)
except:
pass
d = getMapper()
d.addCallback(self._cb_unmap_gotMapper)
return d
示例15: _stopServer
def _stopServer(self, *ignored):
self.stopping = True
try:
yield self._dispatch(self.stopServer)
except Exception as e:
self._error = failure.Failure(e)
finally:
try:
self._cxn.disconnect()
except Exception:
pass
# remove the event trigger, so we don't get
# called again if the reactor shuts down later
if hasattr(self, '_shutdownID'):
reactor.removeSystemEventTrigger(self._shutdownID)