[svn r45541] don't use globals when we might be called from destructors
--HG-- branch : trunk
This commit is contained in:
parent
a5e69d2035
commit
a94866a20b
|
@ -24,13 +24,14 @@ if 'ThreadOut' not in globals():
|
||||||
ThreadOut = py._thread.ThreadOut
|
ThreadOut = py._thread.ThreadOut
|
||||||
|
|
||||||
import os
|
import os
|
||||||
debug = open('/tmp/execnet-debug-%d' % os.getpid() , 'wa')
|
debug = 0 # open('/tmp/execnet-debug-%d' % os.getpid() , 'wa')
|
||||||
|
|
||||||
sysex = (KeyboardInterrupt, SystemExit)
|
sysex = (KeyboardInterrupt, SystemExit)
|
||||||
class StopExecLoop(Exception):
|
class StopExecLoop(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class Gateway(object):
|
class Gateway(object):
|
||||||
|
_StopExecLoop = StopExecLoop
|
||||||
_ThreadOut = ThreadOut
|
_ThreadOut = ThreadOut
|
||||||
remoteaddress = ""
|
remoteaddress = ""
|
||||||
_requestqueue = None
|
_requestqueue = None
|
||||||
|
@ -165,7 +166,7 @@ class Gateway(object):
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
self._executetask(item)
|
self._executetask(item)
|
||||||
except StopExecLoop:
|
except self._StopExecLoop:
|
||||||
break
|
break
|
||||||
finally:
|
finally:
|
||||||
self._trace("_servemain finished")
|
self._trace("_servemain finished")
|
||||||
|
@ -189,7 +190,7 @@ class Gateway(object):
|
||||||
gw._stopsend()
|
gw._stopsend()
|
||||||
execpool.shutdown()
|
execpool.shutdown()
|
||||||
execpool.join()
|
execpool.join()
|
||||||
raise StopExecLoop
|
raise gw._StopExecLoop
|
||||||
execpool.dispatch(gw._executetask, task)
|
execpool.dispatch(gw._executetask, task)
|
||||||
""" % num)
|
""" % num)
|
||||||
self._remotechannelthread = self.remote_exec(source)
|
self._remotechannelthread = self.remote_exec(source)
|
||||||
|
@ -211,7 +212,7 @@ class Gateway(object):
|
||||||
self._trace("execution finished:", repr(source)[:50])
|
self._trace("execution finished:", repr(source)[:50])
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
pass
|
pass
|
||||||
except StopExecLoop:
|
except self._StopExecLoop:
|
||||||
channel.close()
|
channel.close()
|
||||||
raise
|
raise
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue