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

Raymond Hettinger python@rcn.com
Wed, 15 Jan 2003 22:12:20 -0500


Here's one suggestion.

Create a semaphore.

- ThreadingTCPServer creates a new thread for each incoming connection, and makes this a daemon thread (meaning it won't be waited for at the end of the process).

Bump the semaphore count up by one before running each new thread.

- The threads handling the requests are still running, and there's nothing to guarantee that they have processed all requests.

Have the daemons decrement the semaphore when they're done handling a request.

The test driver needs to somehow wait until all the threads handling connections (how many? maybe there's only one?) are finished before it closes sockOut.

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.

Raymond Hettinger

################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# #################################################################