• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python multitask.run函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: runRTMP

def runRTMP(addr=('0.0.0.0', 1935)): # create and run a flash server instance
    server = rtmp.FlashServer()
    server.apps = dict({'record': Record, 'call': Call}) # only support call and record applications  
    server.root = 'www/flvs/'
    server.start(*addr)
    if _debug: print time.asctime(), 'Flash server starts', addr
    try: multitask.run()
    except KeyboardInterrupt: thread.interrupt_main()
开发者ID:BillTheBest,项目名称:videocity,代码行数:8,代码来源:server.py


示例2: run

	def run(self):
		while True:
			try:
				agent = rtmp.FlashServer()
				agent.start()
				multitask.run()
			except:
				sys.exit(0)		
			time.sleep(2)
开发者ID:mmdl,项目名称:sd-xbmc,代码行数:9,代码来源:RTMPListener.py


示例3: startRtmp

 def startRtmp(self):
     try:
         agent = FlashServer()
         agent.root = self.root
         agent.start(self.host, self.port)
         log.info(( time.asctime() , 'Flash Server Starts - %s:%d' % (self.host, self.port)))
         multitask.run()
     except KeyboardInterrupt:
         pass
     log.info((time.asctime() ,'Flash Server Stops'))
开发者ID:jazmit,项目名称:rtmplite-s3-integration,代码行数:10,代码来源:main.py


示例4: runRTMP

def runRTMP(addr=("0.0.0.0", 1935)):  # create and run a flash server instance
    server = rtmp.FlashServer()
    server.apps = dict({"record": Record, "call": Call})  # only support call and record applications
    server.root = _www + _flvs
    server.start(*addr)
    if _debug:
        print time.asctime(), "Flash server starts", addr
    try:
        multitask.run()
    except KeyboardInterrupt:
        thread.interrupt_main()
开发者ID:BillTheBest,项目名称:videocity,代码行数:11,代码来源:videocity.py


示例5: main

def main():
    cput, cget = make_channel()

    def ping():
        for i in range(20):
            cput(i)
            yield ready

    def pong():
        while True:
            print (yield call(whee))

    def whee(answer):
        x = yield cget
        y = yield cget
        answer(x + y)

    spawn(pong())
    spawn(ping())
    run()
开发者ID:JaDogg,项目名称:__py_playground,代码行数:20,代码来源:tryme.py


示例6: threadproc

 def threadproc(arg):
     global sock1, pending, active
     def execute(s):
         if isinstance(s, p2p.ServerSocket):
             n = NetworkStub(Ks=crypto.generateRSA()[0], cert=None, model=model, view=control.view)
             s.start(net=n)
             node = model.addNode(s.net.node.guid, s)
             s.net.node.index = node.index # so that dht.Node has the index.
             active.append(s)
         else:
             if _debug: print s[0], s[1]
             result = yield s[0](**s[1])
             if not isinstance(result, list):
                 print result
             else:
                 if _debug: print result
                 values = map(lambda x: x[0], result)
                 print '\n'.join(values) if values else 'None'
     def waitonsock(sock):
         global pending
         try:
             while True: 
                 yield multitask.recvfrom(sock, 10)
                 for s in pending:
                     multitask.add(execute(s))
                 pending[:] = []
         except StopIteration:
             raise
         except:
             print 'waitonsock', sys.exc_info(), traceback.print_exc()
     multitask.add(waitonsock(sock1)) # this will trigger multitask out of wait loop
      
     if _debug: print 'starting multitask.run()'
     if _trace: sys.settrace(traceit)
     try: multitask.run()
     except KeyboardInterrupt: interrupt_main()
     except: 
         if _debug: print 'exception in multitask.run()'; traceback.print_exc()
开发者ID:ikatson,项目名称:p2p-sip,代码行数:38,代码来源:dhtgui.py


示例7: len

              pass			
            p = None
          log.info('incoming call cancelled')	  
          break
    elif cmd == 'close':
      log.info('incoming call cancelled by %s', arg)
    elif cmd == 'send':
      log.info('paging-mode IM received %s', arg)	


if __name__ == '__main__':
  try:
    argv = sys.argv
    i, username, password, media = 1, None, None, None
    while i < len(argv):
      if argv[i] == '-u':
        if username:		
          multitask.add(register(username, password, media))
          username, password, media = None, None, None		
        username = argv[i+1]
      elif argv[i] == '-p':
        password = argv[i+1]
      elif argv[i] == '-m':
        media = argv[i+1]
      i += 2		
    multitask.add(register(username, password, media))
    multitask.run()
  except KeyboardInterrupt:
    pass

    
开发者ID:4urele,项目名称:p2p-sip,代码行数:29,代码来源:sipcam.py


示例8: filter

        for x in filter(lambda x: x.tag == 'filled', items):
            pass # TODO: more
        
#------------------------------------------------------------------------------
# TESTING        
#------------------------------------------------------------------------------

def _testInterpret():
    try:
        yield interpret('example/goodbye1.vxml') # initial example
        yield interpret('example/goodbye2.vxml') # initial example
        yield interpret('example/leaf.vxml')     # multi-document
        yield interpret('example/app.vxml')      # subdialog
    
    except StopIteration: pass
    except Exception, e:
        print 'exception', type(e), e, traceback.print_exc()
    yield

def _testClose(): yield multitask.sleep(2); exit()

if __name__ == '__main__':
    import doctest; doctest.testmod()    # first run doctest,
    for f in dir():      # then run all _test* functions
        if str(f).find('_test') == 0 and callable(eval(f)):
            multitask.add(globals()[f]())
    try: multitask.run()
    except KeyboardInterrupt: pass
    except select.error: print 'select error'; pass
    sys.exit()
开发者ID:ikatson,项目名称:p2p-sip,代码行数:30,代码来源:voicexml.py


示例9: run

def run():
    '''The run loop which runs the multitask's main loop. This can be terminated by KeyboardInterrupt.'''
    try: multitask.run()
    except KeyboardInterrupt: pass
开发者ID:Atom-machinerule,项目名称:Atoms_custom_webi,代码行数:4,代码来源:sipapi.py


示例10: speed_test_1

def speed_test_1():
    t_start = time.time()
    multitask.add(coroutine_1())
    multitask.add(coroutine_2())
    multitask.run()
    print('sp1: {0} [ms]'.format((time.time() - t_start)*1000))
开发者ID:CUXIDUMDUM,项目名称:reference,代码行数:6,代码来源:coroutine.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python munch.munchify函数代码示例发布时间:2022-05-27
下一篇:
Python multitask.add函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap