Killing httpserver-thread on gui quit

Joonas Paalasmaa joonas at olen.to
Tue Aug 21 14:28:20 EDT 2001


Erno Kuusela wrote:
> 
> In article <11aed8f9.0108210549.4e617422 at posting.google.com>,
> joonas at olen.to (Joonas Paalasmaa) writes:
> 
> | How can I set up a gui and a httpserver threads.
> | When gui's self.quit is executed,
> | httpserver should stop aswell.
> 
> [...]
> 
> | thread1 = threading.Thread( target=httpd.serve_forever() )
                                                          ^^
                                                          Oops!

Oops! I passed httpd.serve_forever()'s return value to Thread, not the
callable object.
Now it works fine.
> 
> if you don't want to serve forever, don't call serve_forever ;)
> 
> do something like...
> 
> while not want_quit:
>   httpd.handle_request()
> 
>   -- erno



More information about the Python-list mailing list