[svn r45541] don't use globals when we might be called from destructors

--HG--
branch : trunk
This commit is contained in:
hpk 2007-08-07 19:54:09 +02:00
parent a5e69d2035
commit a94866a20b
1 changed files with 5 additions and 4 deletions

View File

@ -24,13 +24,14 @@ if 'ThreadOut' not in globals():
ThreadOut = py._thread.ThreadOut
import os
debug = open('/tmp/execnet-debug-%d' % os.getpid() , 'wa')
debug = 0 # open('/tmp/execnet-debug-%d' % os.getpid() , 'wa')
sysex = (KeyboardInterrupt, SystemExit)
class StopExecLoop(Exception):
pass
class Gateway(object):
_StopExecLoop = StopExecLoop
_ThreadOut = ThreadOut
remoteaddress = ""
_requestqueue = None
@ -165,7 +166,7 @@ class Gateway(object):
break
try:
self._executetask(item)
except StopExecLoop:
except self._StopExecLoop:
break
finally:
self._trace("_servemain finished")
@ -189,7 +190,7 @@ class Gateway(object):
gw._stopsend()
execpool.shutdown()
execpool.join()
raise StopExecLoop
raise gw._StopExecLoop
execpool.dispatch(gw._executetask, task)
""" % num)
self._remotechannelthread = self.remote_exec(source)
@ -211,7 +212,7 @@ class Gateway(object):
self._trace("execution finished:", repr(source)[:50])
except (KeyboardInterrupt, SystemExit):
pass
except StopExecLoop:
except self._StopExecLoop:
channel.close()
raise
except: