mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-02 07:53:46 +08:00
Remove thread unsafe context spawning.
This commit is contained in:
@@ -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
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user