Remove thread unsafe context spawning.

This commit is contained in:
Stephen Diehl
2012-03-02 22:01:42 -05:00
parent 0afbd58c0f
commit f885343690
2 changed files with 5 additions and 7 deletions
+1 -3
View File
@@ -139,7 +139,7 @@ class Component(object):
# systems where this becomes needed. Add this option.
#
# http://zeromq.github.com/pyzmq/morethanbindings.html#thread-safety
self.context = self.zmq.Context()
self.context = self.zmq.Context.instance()
self.setup_poller()
@@ -179,8 +179,6 @@ class Component(object):
self.shutdown()
self.teardown_sockets()
if self.context:
self.context.destroy()
if fail:
raise fail
else:
+4 -4
View File
@@ -76,7 +76,7 @@ class Controller(object):
self.polling = True
if not context:
self._ctx = zmq.Context()
self._ctx = zmq.Context.instance()
else:
self._ctx = context
@@ -142,7 +142,7 @@ class Controller(object):
"""
if not context:
context = zmq.Context()
context = zmq.Context.instance()
s = context.socket(zmq.PUSH)
s.connect(self.push_socket)
@@ -156,7 +156,7 @@ class Controller(object):
"""
if not context:
context = zmq.Context()
context = zmq.Context.instance()
s = context.socket(zmq.SUB)
s.connect(self.sub_socket)
@@ -168,7 +168,7 @@ class Controller(object):
self.polling = False
if not context:
context = zmq.Context()
context = zmq.Context.instance()
#logging.info('Shutdown controller')