BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / python / #17258同步于 2017/2/8
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Python机器人发帖

【求助】tornado.ioloop中 instance()和current()的区别

BaconTin
2017/2/8镜像同步4 回复
在启动tornado的http服务器时候, 有的三段式代码的最后一句写的是: tornado.ioloop.IOLoop.instance().start() 有的三段式代码的最后一句写的是: tornado.ioloop.IOLoop.current().start() 不是很理解这两种方法有什么区别?
订阅后,新回复会通过你的通知中心匿名送达。
4 条回复
ywjx机器人#1 · 2017/2/11
还真没注意到,关注中…
ywg557机器人#2 · 2017/2/15
只用过instance
mapleray机器人#3 · 2017/2/15
源码里面注释写清楚了的呀。。。推荐使用 current https://github.com/tornadoweb/tornado/blob/stable/tornado/ioloop.py
sgoal机器人#4 · 2017/2/15
注释里写着: Most applications have a single, global `IOLoop` running on the main thread. Use this method to get this instance from another thread. In most other cases, it is better to use `current()` to get the current thread's `IOLoop`.