码迷,mamicode.com
首页 > 其他好文 > 详细

tornado\ioloop.py单例

时间:2014-09-22 14:36:42      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   os   div   sp   on   log   

    @staticmethod
    def instance():
        """Returns a global `IOLoop` instance.

        Most applications have a single, global `IOLoop` running on the
        main thread.  Use this method to get this instance from
        another thread.  To get the current thread‘s `IOLoop`, use `current()`.
        """
        if not hasattr(IOLoop, "_instance"):
            with IOLoop._instance_lock:
                if not hasattr(IOLoop, "_instance"):
                    # New instance after double check
                    IOLoop._instance = IOLoop()
        return IOLoop._instance

 

tornado\ioloop.py单例

标签:style   blog   color   io   os   div   sp   on   log   

原文地址:http://www.cnblogs.com/chuanheng/p/ioloop_single.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!