當前位置: 首頁>>代碼示例>>Python>>正文


Python twisted.TwistedIOLoop方法代碼示例

本文整理匯總了Python中tornado.platform.twisted.TwistedIOLoop方法的典型用法代碼示例。如果您正苦於以下問題:Python twisted.TwistedIOLoop方法的具體用法?Python twisted.TwistedIOLoop怎麽用?Python twisted.TwistedIOLoop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tornado.platform.twisted的用法示例。


在下文中一共展示了twisted.TwistedIOLoop方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: save_signal_handlers

# 需要導入模塊: from tornado.platform import twisted [as 別名]
# 或者: from tornado.platform.twisted import TwistedIOLoop [as 別名]
def save_signal_handlers():
    saved = {}
    for sig in [signal.SIGINT, signal.SIGTERM, signal.SIGCHLD]:
        saved[sig] = signal.getsignal(sig)
    if "twisted" in repr(saved):
        if not issubclass(IOLoop.configured_class(), TwistedIOLoop):
            # when the global ioloop is twisted, we expect the signal
            # handlers to be installed.  Otherwise, it means we're not
            # cleaning up after twisted properly.
            raise Exception("twisted signal handlers already installed")
    return saved 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:13,代碼來源:twisted_test.py

示例2: stop

# 需要導入模塊: from tornado.platform import twisted [as 別名]
# 或者: from tornado.platform.twisted import TwistedIOLoop [as 別名]
def stop(self):
            # One of twisted's tests fails if I don't delay crash()
            # until the reactor has started, but if I move this to
            # TwistedIOLoop then the tests fail when I'm *not* running
            # tornado-on-twisted-on-tornado.  I'm clearly missing something
            # about the startup/crash semantics, but since stop and crash
            # are really only used in tests it doesn't really matter.
            def f():
                self.reactor.crash()
                # Become current again on restart. This is needed to
                # override real_io_loop's claim to being the current loop.
                self.add_callback(self.make_current)
            self.reactor.callWhenRunning(f) 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:15,代碼來源:twisted_test.py

示例3: stop

# 需要導入模塊: from tornado.platform import twisted [as 別名]
# 或者: from tornado.platform.twisted import TwistedIOLoop [as 別名]
def stop(self):
            # One of twisted's tests fails if I don't delay crash()
            # until the reactor has started, but if I move this to
            # TwistedIOLoop then the tests fail when I'm *not* running
            # tornado-on-twisted-on-tornado.  I'm clearly missing something
            # about the startup/crash semantics, but since stop and crash
            # are really only used in tests it doesn't really matter.
            self.reactor.callWhenRunning(self.reactor.crash) 
開發者ID:viewfinderco,項目名稱:viewfinder,代碼行數:10,代碼來源:twisted_test.py


注:本文中的tornado.platform.twisted.TwistedIOLoop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。