V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ufo22940268
V2EX  ›  问与答

Python中的Looper

  •  
  •   ufo22940268 · 2013-08-10 22:07:37 +08:00 · 2559 次点击
    这是一个创建于 3936 天前的主题,其中的信息可能已经有所发展或是发生改变。
    Python里面有没有什么looper,完成类似于android中的looper,又或者是tornado中的IOLooper的功能,大概就是来一个请求,处理一个请求,在一个新的线程中。

    多谢,找了一天了没找到(害羞
    2 条回复    1970-01-01 08:00:00 +08:00
    9hills
        1
    9hills  
       2013-08-11 01:04:35 +08:00 via Android   ❤️ 1
    queue?
    timonwong
        2
    timonwong  
       2013-08-11 09:48:10 +08:00   ❤️ 1
    tornado难道不是Python写的吗,另外python自带了一个asyncore,你可以去看看。

    另外:tornado的ioloop(android的IOLooper我不知道怎样), 对新来的请求不会开新线程,所以要自己保证异步(比如tornado.gen.Task, threading等等)。还有就是要小心CPU密集型的任务,如果你用CPython的话。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2504 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 15:08 · PVG 23:08 · LAX 08:08 · JFK 11:08
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.