This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author socketpair
Recipients giampaolo.rodola, neologix, petri.lehtinen, pitrou, santoso.wijaya, socketpair
Date 2011-07-26.16:52:20
SpamBayes Score 0.009647746
Marked as misclassified No
Message-id <1311699141.09.0.915051235446.issue12463@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2011-07-26 16:52:21socketpairsetrecipients: + socketpair, pitrou, giampaolo.rodola, neologix, santoso.wijaya, petri.lehtinen
2011-07-26 16:52:21socketpairsetmessageid: <1311699141.09.0.915051235446.issue12463@psf.upfronthosting.co.za>
2011-07-26 16:52:20socketpairlinkissue12463 messages
2011-07-26 16:52:20socketpaircreate