##// END OF EJS Templates
Thread safety fix in KernelManager:...
epatters -
Show More
@@ -166,15 +166,15 b' class XReqSocketChannel(ZmqSocketChannel):'
166 command_queue = None
166 command_queue = None
167
167
168 def __init__(self, context, session, address):
168 def __init__(self, context, session, address):
169 self.command_queue = Queue()
170 super(XReqSocketChannel, self).__init__(context, session, address)
169 super(XReqSocketChannel, self).__init__(context, session, address)
170 self.command_queue = Queue()
171 self.ioloop = ioloop.IOLoop()
171
172
172 def run(self):
173 def run(self):
173 """The thread's main activity. Call start() instead."""
174 """The thread's main activity. Call start() instead."""
174 self.socket = self.context.socket(zmq.XREQ)
175 self.socket = self.context.socket(zmq.XREQ)
175 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
176 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
176 self.socket.connect('tcp://%s:%i' % self.address)
177 self.socket.connect('tcp://%s:%i' % self.address)
177 self.ioloop = ioloop.IOLoop()
178 self.iostate = POLLERR|POLLIN
178 self.iostate = POLLERR|POLLIN
179 self.ioloop.add_handler(self.socket, self._handle_events,
179 self.ioloop.add_handler(self.socket, self._handle_events,
180 self.iostate)
180 self.iostate)
@@ -359,6 +359,7 b' class SubSocketChannel(ZmqSocketChannel):'
359
359
360 def __init__(self, context, session, address):
360 def __init__(self, context, session, address):
361 super(SubSocketChannel, self).__init__(context, session, address)
361 super(SubSocketChannel, self).__init__(context, session, address)
362 self.ioloop = ioloop.IOLoop()
362
363
363 def run(self):
364 def run(self):
364 """The thread's main activity. Call start() instead."""
365 """The thread's main activity. Call start() instead."""
@@ -366,7 +367,6 b' class SubSocketChannel(ZmqSocketChannel):'
366 self.socket.setsockopt(zmq.SUBSCRIBE,'')
367 self.socket.setsockopt(zmq.SUBSCRIBE,'')
367 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
368 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
368 self.socket.connect('tcp://%s:%i' % self.address)
369 self.socket.connect('tcp://%s:%i' % self.address)
369 self.ioloop = ioloop.IOLoop()
370 self.iostate = POLLIN|POLLERR
370 self.iostate = POLLIN|POLLERR
371 self.ioloop.add_handler(self.socket, self._handle_events,
371 self.ioloop.add_handler(self.socket, self._handle_events,
372 self.iostate)
372 self.iostate)
@@ -444,15 +444,15 b' class RepSocketChannel(ZmqSocketChannel):'
444 msg_queue = None
444 msg_queue = None
445
445
446 def __init__(self, context, session, address):
446 def __init__(self, context, session, address):
447 self.msg_queue = Queue()
448 super(RepSocketChannel, self).__init__(context, session, address)
447 super(RepSocketChannel, self).__init__(context, session, address)
448 self.ioloop = ioloop.IOLoop()
449 self.msg_queue = Queue()
449
450
450 def run(self):
451 def run(self):
451 """The thread's main activity. Call start() instead."""
452 """The thread's main activity. Call start() instead."""
452 self.socket = self.context.socket(zmq.XREQ)
453 self.socket = self.context.socket(zmq.XREQ)
453 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
454 self.socket.setsockopt(zmq.IDENTITY, self.session.session)
454 self.socket.connect('tcp://%s:%i' % self.address)
455 self.socket.connect('tcp://%s:%i' % self.address)
455 self.ioloop = ioloop.IOLoop()
456 self.iostate = POLLERR|POLLIN
456 self.iostate = POLLERR|POLLIN
457 self.ioloop.add_handler(self.socket, self._handle_events,
457 self.ioloop.add_handler(self.socket, self._handle_events,
458 self.iostate)
458 self.iostate)
General Comments 0
You need to be logged in to leave comments. Login now