~ubuntu-branches/ubuntu/wily/pyzmq/wily

« back to all changes in this revision

Viewing changes to zmq/eventloop/ioloop.py

  • Committer: Package Import Robot
  • Author(s): Julian Taylor, Julian Taylor, Jakub Wilk
  • Date: 2013-05-09 15:07:29 UTC
  • mfrom: (2.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130509150729-1xf0eb5wrokflfm7
Tags: 2.2.0.1-2
[ Julian Taylor ]
* upload to unstable
* python-gevent-dbg is fixed, enable python2 dbg autopkgtests
* cython0.19-compat.patch: fix build with cython 0.19

[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
    WRITE = _EPOLLOUT
116
116
    ERROR = _EPOLLERR | _EPOLLHUP
117
117
 
 
118
    # Global lock for creating global IOLoop instance
 
119
    _instance_lock = threading.Lock()
 
120
 
118
121
    def __init__(self, impl=None):
119
122
        self._impl = impl or _poll()
120
123
        if hasattr(self._impl, 'fileno'):
153
156
                    self.io_loop = io_loop or IOLoop.instance()
154
157
        """
155
158
        if not hasattr(IOLoop, "_instance"):
156
 
            IOLoop._instance = IOLoop()
 
159
            with IOLoop._instance_lock:
 
160
                if not hasattr(IOLoop, "_instance"):
 
161
                    # New instance after double check
 
162
                    IOLoop._instance = IOLoop()
157
163
        return IOLoop._instance
158
164
 
159
165
    @staticmethod