当前位置: 首页>>代码示例>>Python>>正文


Python PosixReactorBase.crash方法代码示例

本文整理汇总了Python中twisted.internet.posixbase.PosixReactorBase.crash方法的典型用法代码示例。如果您正苦于以下问题:Python PosixReactorBase.crash方法的具体用法?Python PosixReactorBase.crash怎么用?Python PosixReactorBase.crash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.internet.posixbase.PosixReactorBase的用法示例。


在下文中一共展示了PosixReactorBase.crash方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def __init__(self, io_loop=None):
        if not io_loop:
            io_loop = tornado.ioloop.IOLoop.current()
        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)
        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)

    # IReactorTime 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:22,代码来源:twisted.py

示例2: crash

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def crash(self):
        PosixReactorBase.crash(self)
        self._io_loop.stop() 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:5,代码来源:twisted.py

示例3: stop

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def stop(self):
        self.reactor.crash() 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:4,代码来源:twisted.py

示例4: mainLoop

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def mainLoop(self):
        """
        Run the runner (C{CFRunLoopRun} or something that calls it), which runs
        the run loop until C{crash()} is called.
        """
        self._inCFLoop = True
        try:
            self._runner()
        finally:
            self._inCFLoop = False 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:12,代码来源:cfreactor.py

示例5: _scheduleSimulate

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def _scheduleSimulate(self, force=False):
        """
        Schedule a call to C{self.runUntilCurrent}.  This will cancel the
        currently scheduled call if it is already scheduled.

        @param force: Even if there are no timed calls, make sure that
            C{runUntilCurrent} runs immediately (in a 0-seconds-from-now
            C{CFRunLoopTimer}).  This is necessary for calls which need to
            trigger behavior of C{runUntilCurrent} other than running timed
            calls, such as draining the thread call queue or calling C{crash()}
            when the appropriate flags are set.

        @type force: C{bool}
        """
        if self._currentSimulator is not None:
            CFRunLoopTimerInvalidate(self._currentSimulator)
            self._currentSimulator = None
        timeout = self.timeout()
        if force:
            timeout = 0.0
        if timeout is not None:
            fireDate = (CFAbsoluteTimeGetCurrent() + timeout)
            def simulate(cftimer, extra):
                self._currentSimulator = None
                self.runUntilCurrent()
                self._scheduleSimulate()
            c = self._currentSimulator = CFRunLoopTimerCreate(
                kCFAllocatorDefault, fireDate,
                0, 0, 0, simulate, None
            )
            CFRunLoopAddTimer(self._cfrunloop, c, kCFRunLoopCommonModes) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:33,代码来源:cfreactor.py

示例6: crash

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
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:proxysh,项目名称:Safejumper-for-Desktop,代码行数:13,代码来源:cfreactor.py

示例7: mainLoop

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def mainLoop(self):
        """
        Run the runner (L{CFRunLoopRun} or something that calls it), which runs
        the run loop until C{crash()} is called.
        """
        self._inCFLoop = True
        try:
            self._runner()
        finally:
            self._inCFLoop = False 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:12,代码来源:cfreactor.py

示例8: _scheduleSimulate

# 需要导入模块: from twisted.internet.posixbase import PosixReactorBase [as 别名]
# 或者: from twisted.internet.posixbase.PosixReactorBase import crash [as 别名]
def _scheduleSimulate(self, force=False):
        """
        Schedule a call to C{self.runUntilCurrent}.  This will cancel the
        currently scheduled call if it is already scheduled.

        @param force: Even if there are no timed calls, make sure that
            C{runUntilCurrent} runs immediately (in a 0-seconds-from-now
            {CFRunLoopTimer}).  This is necessary for calls which need to
            trigger behavior of C{runUntilCurrent} other than running timed
            calls, such as draining the thread call queue or calling C{crash()}
            when the appropriate flags are set.

        @type force: C{bool}
        """
        if self._currentSimulator is not None:
            CFRunLoopTimerInvalidate(self._currentSimulator)
            self._currentSimulator = None
        timeout = self.timeout()
        if force:
            timeout = 0.0
        if timeout is not None:
            fireDate = (CFAbsoluteTimeGetCurrent() + timeout)
            def simulate(cftimer, extra):
                self._currentSimulator = None
                self.runUntilCurrent()
                self._scheduleSimulate()
            c = self._currentSimulator = CFRunLoopTimerCreate(
                kCFAllocatorDefault, fireDate,
                0, 0, 0, simulate, None
            )
            CFRunLoopAddTimer(self._cfrunloop, c, kCFRunLoopCommonModes) 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:33,代码来源:cfreactor.py


注:本文中的twisted.internet.posixbase.PosixReactorBase.crash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。