Commit f9addb67 authored by Brett Cannon's avatar Brett Cannon

Change from a threading.Condition object to a threading.Event object for

signalling when the TCP server is done.  Should hopefully solve hanging
issues for Solaris 8 & 9.  Solves the apparent hanging issue with OS X.

Closes patch #729988 .
parent 13da5fa9
...@@ -88,7 +88,8 @@ class LogRecordStreamHandler(StreamRequestHandler): ...@@ -88,7 +88,8 @@ class LogRecordStreamHandler(StreamRequestHandler):
logger = logging.getLogger(logname) logger = logging.getLogger(logname)
logger.handle(record) logger.handle(record)
socketDataProcessed = threading.Condition() # The server sets socketDataProcessed when it's done.
socketDataProcessed = threading.Event()
class LogRecordSocketReceiver(ThreadingTCPServer): class LogRecordSocketReceiver(ThreadingTCPServer):
""" """
...@@ -115,9 +116,7 @@ class LogRecordSocketReceiver(ThreadingTCPServer): ...@@ -115,9 +116,7 @@ class LogRecordSocketReceiver(ThreadingTCPServer):
self.handle_request() self.handle_request()
abort = self.abort abort = self.abort
#notify the main thread that we're about to exit #notify the main thread that we're about to exit
socketDataProcessed.acquire() socketDataProcessed.set()
socketDataProcessed.notify()
socketDataProcessed.release()
def process_request(self, request, client_address): def process_request(self, request, client_address):
#import threading #import threading
...@@ -467,9 +466,7 @@ def test_main(): ...@@ -467,9 +466,7 @@ def test_main():
finally: finally:
#wait for TCP receiver to terminate #wait for TCP receiver to terminate
socketDataProcessed.acquire()
socketDataProcessed.wait() socketDataProcessed.wait()
socketDataProcessed.release()
for thread in threads: for thread in threads:
thread.join() thread.join()
banner("logrecv output", "begin") banner("logrecv output", "begin")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment