Managing a multiple threaded service
Mark Hammond
skippy.hammond at gmail.com
Wed Jun 17 02:45:24 EDT 2009
On 17/06/2009 4:23 PM, Paul Hemans wrote:
> Hi,
> New to Python ....
> I've got 2 threads 1 is the SimpleHTTPRequestHandler, the other polls a site
> for data. I want to run the program as a windows service.
> My questions are:
> Should both of them run as threads and then just have an infinite loop with
> a sleep in the main thread in order to stop the main program from just
> terminating?
No need for a loop - just have the main thread wait forever for the stop
request. The main problem I forsee is asking the socketserver thread to
terminate as it is likely to be inside 'accept' or some other blocking
function.
HTH,
Mark
More information about the Python-list
mailing list