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


Python iocpreactor.install函数代码示例

本文整理汇总了Python中twisted.internet.iocpreactor.install函数的典型用法代码示例。如果您正苦于以下问题:Python install函数的具体用法?Python install怎么用?Python install使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: SvcDoRun

 def SvcDoRun(self):
     import servicemanager
     servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STARTED,(self._svc_display_name_, ''))
     from pulse2.package_server.config import P2PServerCP
     config = P2PServerCP()
     config.setup(self.inifile)
     if config.use_iocp_reactor:
         from twisted.internet import iocpreactor
         iocpreactor.install()
     self.CheckForQuit()
     self.init(config)
     twisted.internet.reactor.run(installSignalHandlers=0)
     servicemanager.LogMsg(servicemanager.EVENTLOG_INFORMATION_TYPE, servicemanager.PYS_SERVICE_STOPPED,(self._svc_display_name_, ''))
开发者ID:AnatomicJC,项目名称:mmc,代码行数:13,代码来源:pulse2-package-server-win32.py

示例2: SvcDoRun

    def SvcDoRun(self):
        try:
            logmsg("service run")
            import servicemanager
            # Write a 'started' event to the event log...
            win32evtlogutil.ReportEvent(self._svc_display_name_,
                                        servicemanager.PYS_SERVICE_STARTED,
                                        0, # category
                                        servicemanager.EVENTLOG_INFORMATION_TYPE,
                                        (self._svc_name_, ''))

            reactor_type = registry.get_registry_value('reactor')
            if reactor_type == 'iocp':
                from twisted.internet import iocpreactor
                iocpreactor.install()
            else:
                from twisted.internet import selectreactor
                selectreactor.install()
            from twisted.internet import reactor

            if os.path.exists('DISABLE_STARTUP'):
                logmsg("DISABLE_STARTUP exists: exiting")
            else:
                logmsg("runing reactorthread")

                # launch main thread...
                thread.start_new_thread(self.launch_node, ())

                # ...and block until service stop request
                win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)

                logmsg("wake up")

                reactor.callFromThread(reactor.stop)

                time.sleep(2) # give the node/reactor a chance to cleanup

            # and write a 'stopped' event to the event log.
            win32evtlogutil.ReportEvent(self._svc_display_name_,
                                        servicemanager.PYS_SERVICE_STOPPED,
                                        0, # category
                                        servicemanager.EVENTLOG_INFORMATION_TYPE,
                                        (self._svc_name_, ''))
        except:
            try:
                logmsg("exception")
                traceback.print_exc(None, logfilehandle)
                logfilehandle.flush()
                logfilehandle.close()
            except:
                os.abort()
开发者ID:p-static,项目名称:tahoe-lafs,代码行数:51,代码来源:tahoesvc.py

示例3: main

from __future__ import division

import base64
import gc
import json
import os
import random
import sys
import time
import signal
import traceback
import urlparse

if '--iocp' in sys.argv:
    from twisted.internet import iocpreactor
    iocpreactor.install()
from twisted.internet import defer, reactor, protocol, tcp
from twisted.web import server
from twisted.python import log
from nattraverso import portmapper, ipdiscover

import bitcoin.p2p as bitcoin_p2p, bitcoin.data as bitcoin_data
from bitcoin import stratum, worker_interface, helper
from util import fixargparse, jsonrpc, variable, deferral, math, logging, switchprotocol
from . import networks, web, work
import p2pool, p2pool.data as p2pool_data, p2pool.node as p2pool_node

@defer.inlineCallbacks
def main(args, net, datadir_path, merged_urls, worker_endpoint):
    try:
        print 'p2pool (version %s)' % (p2pool.__version__,)
开发者ID:and-then,项目名称:p2pool-rav,代码行数:31,代码来源:main.py

示例4: install


import sys
from os import getcwd
sys.path.append(getcwd())

USE_WX = "-wx" in sys.argv

if sys.platform == 'win32' and not USE_WX:
    from twisted.internet.iocpreactor import install
else:
    USE_WX = True
    import wx
    from twisted.internet.wxreactor import install

install()

from mud.gamesettings import *
from config import *
from twisted.internet import reactor
from twisted.spread import pb
from twisted.cred.credentials import UsernamePassword
from serverdb import CreateDatabase,CharDB,ReplicateDB
from zlib import decompress
from traceback import print_stack,print_exc
from base64 import encodestring,decodestring
from cPickle import dumps,loads
from time import time
from md5 import md5
import random
from mud.server.config import LoadConfiguration
开发者ID:carriercomm,项目名称:solinia_depreciated,代码行数:29,代码来源:server.py


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