Message141170
class ThreadedRPC(Thread, SimpleXMLRPCServer):
def __init__(self):
Thread.__init__(self)
SimpleXMLRPCServer.__init__(self)
# python bug workaround, which eliminate hang on test_exception
self._BaseServer__is_shut_down.set()
self.daemon = True
def run(self):
raise Exception('race-condition!')
self.serve_forever()
def main():
rpc = ThreadedRPC(RPC_LISTEN_ADDR, allow_none=True)
rpc.start() # from Thread
# term set by signal handler
while rpc.isAlive() and not term:
time.sleep(0.5)
# note, thread may die in any time! regardles of isAlive()
# if thread dead before calling serve_forever(), will hang here without a workaround
rpc.shutdown() # from xmlrpcservr.
rpc.join() # from thread (no problem, as thread is not Alive) |
|
Date |
User |
Action |
Args |
2011-07-26 16:52:21 | socketpair | set | recipients:
+ socketpair, pitrou, giampaolo.rodola, neologix, santoso.wijaya, petri.lehtinen |
2011-07-26 16:52:21 | socketpair | set | messageid: <1311699141.09.0.915051235446.issue12463@psf.upfronthosting.co.za> |
2011-07-26 16:52:20 | socketpair | link | issue12463 messages |
2011-07-26 16:52:20 | socketpair | create | |
|