]> granicus.if.org Git - python/commitdiff
Change from a threading.Condition object to a threading.Event object for
authorBrett Cannon <bcannon@gmail.com>
Wed, 30 Apr 2003 05:32:32 +0000 (05:32 +0000)
committerBrett Cannon <bcannon@gmail.com>
Wed, 30 Apr 2003 05:32:32 +0000 (05:32 +0000)
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 .

Lib/test/test_logging.py

index 93fb4a2706d7fbc0f29a8513289b877c96e9e34d..60995620bbde7eec7ca4ad1061f3283e9c37f1c9 100644 (file)
@@ -88,7 +88,8 @@ class LogRecordStreamHandler(StreamRequestHandler):
         logger = logging.getLogger(logname)
         logger.handle(record)
 
-socketDataProcessed = threading.Condition()
+# The server sets socketDataProcessed when it's done.
+socketDataProcessed = threading.Event()
 
 class LogRecordSocketReceiver(ThreadingTCPServer):
     """
@@ -115,9 +116,7 @@ class LogRecordSocketReceiver(ThreadingTCPServer):
                 self.handle_request()
             abort = self.abort
         #notify the main thread that we're about to exit
-        socketDataProcessed.acquire()
-        socketDataProcessed.notify()
-        socketDataProcessed.release()
+        socketDataProcessed.set()
 
     def process_request(self, request, client_address):
         #import threading
@@ -467,9 +466,7 @@ def test_main():
 
     finally:
         #wait for TCP receiver to terminate
-        socketDataProcessed.acquire()
         socketDataProcessed.wait()
-        socketDataProcessed.release()
         for thread in threads:
             thread.join()
         banner("logrecv output", "begin")