> [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/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4