[Python-Dev] test_logging failing on Windows 2000 (original) (raw)

Guido van Rossum guido@python.org
Thu, 16 Jan 2003 09:38:21 -0500


[Raymond] > Create a semaphore. [snip] > Bump the semaphore count up by one before running each new > thread. [snip] > Have the daemons decrement the semaphore when they're done > handling a request. [snip] > Have the last step in the main thread be a blocking call to the semaphore > so that it doesn't bail out until all requests are handled.

A semaphore seems the right thing, but I think it would need to be incremented after each request rather than for each thread (to correctly match with the decrement after each request). This needs to be done in the test script before each logging call - the alternative, to have a SocketHandler-derived class used in the test script, may be too intrusive.

I'd prefer a different approach: register the threads started by ThreadingTCPServer in the 'threads' variable. Then they are waited for in the 'finally:' clause. You probably should move the flushing and closing of sockOut also.

--Guido van Rossum (home page: http://www.python.org/~guido/)