當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。