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


Python IOLoop.start方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [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: install

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def install(io_loop=None):
    """Install this package as the default Twisted reactor.

    ``install()`` must be called very early in the startup process,
    before most other twisted-related imports. Conversely, because it
    initializes the `.IOLoop`, it cannot be called before
    `.fork_processes` or multi-process `~.TCPServer.start`. These
    conflicting requirements make it difficult to use `.TornadoReactor`
    in multi-process mode, and an external process manager such as
    ``supervisord`` is recommended instead.

    .. versionchanged:: 4.1
       The ``io_loop`` argument is deprecated.

    """
    if not io_loop:
        io_loop = tornado.ioloop.IOLoop.current()
    reactor = TornadoReactor(io_loop)
    from twisted.internet.main import installReactor
    installReactor(reactor)
    return reactor 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:23,代碼來源:twisted.py

示例3: __init__

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
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)

    # IReactorTime 
開發者ID:tp4a,項目名稱:teleport,代碼行數:20,代碼來源:twisted.py

示例4: install

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def install():
    """Install this package as the default Twisted reactor.

    ``install()`` must be called very early in the startup process,
    before most other twisted-related imports. Conversely, because it
    initializes the `.IOLoop`, it cannot be called before
    `.fork_processes` or multi-process `~.TCPServer.start`. These
    conflicting requirements make it difficult to use `.TornadoReactor`
    in multi-process mode, and an external process manager such as
    ``supervisord`` is recommended instead.

    .. versionchanged:: 5.0
       The ``io_loop`` argument (deprecated since version 4.1) has been removed.

    .. deprecated:: 5.1

       This functio will be removed in Tornado 6.0. Use
       ``twisted.internet.asyncioreactor.install`` instead.
    """
    reactor = TornadoReactor()
    from twisted.internet.main import installReactor  # type: ignore
    installReactor(reactor)
    return reactor 
開發者ID:tp4a,項目名稱:teleport,代碼行數:25,代碼來源:twisted.py

示例5: __init__

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
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)

    # IReactorTime 
開發者ID:omererdem,項目名稱:honeything,代碼行數:21,代碼來源:twisted.py

示例6: getWriters

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def getWriters(self):
        return self._writers.keys()

    # The following functions are mainly used in twisted-style test cases;
    # it is expected that most users of the TornadoReactor will call
    # IOLoop.start() instead of Reactor.run(). 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:8,代碼來源:twisted.py

示例7: mainLoop

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def mainLoop(self):
        # Since this class is intended to be used in applications
        # where the top-level event loop is ``io_loop.start()`` rather
        # than ``reactor.run()``, it is implemented a little
        # differently than other Twisted reactors. We override
        # ``mainLoop`` instead of ``doIteration`` and must implement
        # timed call functionality on top of `.IOLoop.add_timeout`
        # rather than using the implementation in
        # ``PosixReactorBase``.
        self._io_loop.start() 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:12,代碼來源:twisted.py

示例8: start

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def start(self):
        old_current = IOLoop.current(instance=False)
        try:
            self._setup_logging()
            self.make_current()
            self.reactor.run()
        finally:
            if old_current is None:
                IOLoop.clear_current()
            else:
                old_current.make_current() 
開發者ID:tao12345666333,項目名稱:tornado-zh,代碼行數:13,代碼來源:twisted.py

示例9: mainLoop

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def mainLoop(self):
        self._io_loop.start() 
開發者ID:viewfinderco,項目名稱:viewfinder,代碼行數:4,代碼來源:twisted.py

示例10: start

# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import start [as 別名]
def start(self):
        self.reactor.run() 
開發者ID:viewfinderco,項目名稱:viewfinder,代碼行數:4,代碼來源:twisted.py


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