def __init__(self, io, execthreads=None, _startcount=2): |
""" initialize core gateway, using the given |
inputoutput object and 'execthreads' execution |
threads. |
""" |
global registered_cleanup |
self._execpool = WorkerPool(maxthreads=execthreads) |
self._io = io |
self._outgoing = Queue.Queue() |
self._channelfactory = ChannelFactory(self, _startcount) |
if not registered_cleanup: |
atexit.register(cleanup_atexit) |
registered_cleanup = True |
_active_sendqueues[self._outgoing] = True |
self._pool = NamedThreadPool(receiver = self._thread_receiver, |
-> sender = self._thread_sender) |